m = 'Активных юзеров {}'.format(len(active_users)) asyncio.Task(send_message(message.chat_id, m), loop=loop) @bot.command(r"/help") def help(message, match): m = '''/start\n /stop\n /online\n /help -- это сообщение\n online {} '''.format(len(active_users)) asyncio.Task(send_message(message.chat_id, m), loop=loop) @bot.default def message_def(message): print(message.sender,' ',message.text) question_loop.comparison(message.text, message.sender) try: loop.run_until_complete(asyncio.wait([ asyncio.async(bot.loop()), asyncio.async(question_loop.time_loop()) ]) ) except KeyboardInterrupt: pass finally: loop.close()
w.add( str(f['word']) ) if f['s']: q = '' for _ in f['s']: if q: q+="' або '" q+= '{}'.format(_) s+= "Ви помилились, не '{}', а '{}'\n".format(f['word'],q) return s with (yield from sem): speller = yield from get_speller(item.text) s = rewriter(speller) if s: yield from item.reply(s) if __name__ == '__main__': loop = asyncio.get_event_loop() try: loop.run_until_complete(asyncio.async(bot.loop())) except KeyboardInterrupt: pass finally: loop.close()