-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
31 lines (24 loc) · 1.08 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import asyncio
import logging
from aiogram import Bot, Dispatcher, types
from aiogram.enums.parse_mode import ParseMode
from aiogram.fsm.storage.memory import MemoryStorage
from handlers import router
import config
async def main():
bot = Bot(token=config.BOT_TOKEN, parse_mode=ParseMode.HTML)
dp = Dispatcher(storage=MemoryStorage())
dp.include_router(router)
await bot.delete_webhook(drop_pending_updates=True)
await dp.start_polling(bot, allowed_updates=dp.resolve_used_update_types())
@dp.callback_query_handler(lambda c: c.data == 'answer')
async def handle_answer_button(callback_query: types.CallbackQuery):
print(callback_query)
await callback_query.answer('Вы ответили на вопрос')
@dp.callback_query_handler(lambda c: c.data == 'cancel')
async def handle_cancel_button(callback_query: types.CallbackQuery):
print(callback_query)
await callback_query.answer('Вопрос был отклонён техподдержкой')
if __name__ == "__main__":
logging.basicConfig(level=logging.INFO)
asyncio.run(main())