diff options
Diffstat (limited to 'main.py')
| -rw-r--r-- | main.py | 17 |
1 files changed, 11 insertions, 6 deletions
| @@ -1,21 +1,26 @@ | |||
| 1 | import optparse | ||
| 2 | |||
| 3 | from aiogram import executor, types as t, Dispatcher | ||
| 4 | import logging | 1 | import logging |
| 5 | 2 | ||
| 3 | from aiogram import Dispatcher, executor | ||
| 4 | from aiogram import types as t | ||
| 5 | |||
| 6 | logging.basicConfig(level=logging.INFO) | 6 | logging.basicConfig(level=logging.INFO) |
| 7 | 7 | ||
| 8 | |||
| 8 | async def on_start(dp: Dispatcher): | 9 | async def on_start(dp: Dispatcher): |
| 9 | from shared.commands import commands | 10 | from shared.commands import commands |
| 11 | |||
| 10 | for scope, cmd in commands.items(): | 12 | for scope, cmd in commands.items(): |
| 11 | await dp.bot.delete_my_commands(scope) | 13 | await dp.bot.delete_my_commands(scope) |
| 12 | await dp.bot.set_my_commands(cmd, scope) | 14 | await dp.bot.set_my_commands(cmd, scope) |
| 13 | 15 | ||
| 14 | 16 | ||
| 15 | if __name__ == '__main__': | 17 | if __name__ == "__main__": |
| 16 | from shared.instances import dp | ||
| 17 | import handlers | 18 | import handlers |
| 19 | from shared.instances import dp | ||
| 18 | 20 | ||
| 19 | executor.start_polling( | 21 | executor.start_polling( |
| 20 | dp, allowed_updates=t.AllowedUpdates.all(), on_startup=on_start, skip_updates=True | 22 | dp, |
| 23 | allowed_updates=t.AllowedUpdates.all(), | ||
| 24 | on_startup=on_start, | ||
| 25 | skip_updates=True, | ||
| 21 | ) | 26 | ) |
