Make base tg bot

This commit is contained in:
BitHeaven 2024-08-03 17:39:11 +03:00
parent 0a456d4458
commit 477670ca28
1 changed files with 26 additions and 0 deletions

26
tgbot/main.py Normal file
View File

@ -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())