From 477670ca286be131928aabddb563cb4695ddbe03 Mon Sep 17 00:00:00 2001 From: BitHeaven Date: Sat, 3 Aug 2024 17:39:11 +0300 Subject: [PATCH] Make base tg bot --- tgbot/main.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 tgbot/main.py diff --git a/tgbot/main.py b/tgbot/main.py new file mode 100644 index 0000000..88e0b63 --- /dev/null +++ b/tgbot/main.py @@ -0,0 +1,26 @@ +import asyncio +from config import * +from aiogram import Bot, Dispatcher +from aiogram.types import Message +from aiogram.enums import ParseMode +from aiogram.client.default import DefaultBotProperties + + +dp = Dispatcher() + + +@dp.message() +async def echo_handler(message: Message): + try: + await message.send_copy(chat_id=message.chat.id) + except TypeError: + await message.answer('Nice try!') + + +async def main(self): + bot = Bot(token=TOKEN, default=DefaultBotProperties(parse_mode=ParseMode.HTML)) + await dp.start_polling(bot) + + +if __name__ == "__main__": + asyncio.run(self.main())