13 lines
413 B
Python
13 lines
413 B
Python
class TelegramLoop:
|
|
def __init__(self, app):
|
|
self.app = app
|
|
self.bot = telegram.Bot(token=app.config.telegram_bot_token)
|
|
self.dispatcher = telegram.Dispatcher(bot=self.bot)
|
|
self.dispatcher.register_message_handler(self.on_message)
|
|
|
|
async def run(self):
|
|
await self.dispatcher.start_polling()
|
|
|
|
async def on_message(self, msg):
|
|
print(msg, file=sys.stderr)
|