test-dock-fast-nginx-aio/tgbot/main.py

27 lines
577 B
Python
Raw Normal View History

2024-08-03 22:39:11 +08:00
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())