Пример высокоуровневого вебхука
This commit is contained in:
parent
7336b2ebb9
commit
c844d2b2e6
23
examples/webhook/high_level.py
Normal file
23
examples/webhook/high_level.py
Normal file
@ -0,0 +1,23 @@
|
||||
import asyncio
|
||||
import logging
|
||||
|
||||
from maxapi import Bot, Dispatcher
|
||||
from maxapi.types import MessageCreated
|
||||
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
|
||||
bot = Bot('тут_ваш_токен')
|
||||
dp = Dispatcher()
|
||||
|
||||
|
||||
@dp.message_created()
|
||||
async def handle_message(event: MessageCreated):
|
||||
await event.message.answer('Бот работает через вебхук!')
|
||||
|
||||
|
||||
async def main():
|
||||
await dp.handle_webhook(bot)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
asyncio.run(main())
|
Loading…
x
Reference in New Issue
Block a user