This repository has been archived on 2023-01-19. You can view files and clone it, but cannot push or open issues or pull requests.
MirrorTea/mirrortea/messengers/telegram.py

16 lines
434 B
Python
Raw Normal View History

import aiogram
import sys
class Telegram:
def __init__(self, app):
self.app = app
self.bot = aiogram.Bot(token=app.config.telegram_bot_token)
self.dispatcher = aiogram.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)