mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-12 18:19:34 +00:00
Webhook. Allow requests only from Telegram servers. // Optional
This commit is contained in:
parent
6d9bdce935
commit
f050d08c75
2 changed files with 44 additions and 1 deletions
|
|
@ -61,7 +61,7 @@ def start_pooling(dispatcher, *, loop=None, skip_updates=False, on_startup=None,
|
|||
|
||||
|
||||
def start_webhook(dispatcher, webhook_path, *, loop=None, skip_updates=None, on_startup=None, on_shutdown=None,
|
||||
**kwargs):
|
||||
check_ip=False, **kwargs):
|
||||
log.warning('Start bot with webhook.')
|
||||
if loop is None:
|
||||
loop = dispatcher.loop
|
||||
|
|
@ -72,8 +72,10 @@ def start_webhook(dispatcher, webhook_path, *, loop=None, skip_updates=None, on_
|
|||
app['_startup_callback'] = on_startup
|
||||
app['_shutdown_callback'] = on_shutdown
|
||||
app['_skip_updates'] = skip_updates
|
||||
app['_check_ip'] = check_ip
|
||||
|
||||
app.on_startup.append(_wh_startup)
|
||||
app.on_shutdown.append(_wh_shutdown)
|
||||
|
||||
web.run_app(app, loop=loop, **kwargs)
|
||||
return app
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue