Добавлены миддлвари на примере ThrottlingMiddleware

This commit is contained in:
Forden
2020-04-06 00:58:24 +03:00
parent 90791c3091
commit c3da772339
9 changed files with 96 additions and 2 deletions

View File

@@ -1,8 +1,10 @@
from aiogram import Dispatcher
from aiogram.dispatcher.filters import CommandStart
from aiogram.dispatcher.filters import CommandStart, CommandHelp
from .help import bot_help
from .start import bot_start
def setup(dp: Dispatcher):
dp.register_message_handler(start, CommandStart())
dp.register_message_handler(bot_start, CommandStart())
dp.register_message_handler(bot_help, CommandHelp())

13
handlers/user/help.py Normal file
View File

@@ -0,0 +1,13 @@
from aiogram import types
from utils.misc import rate_limit
@rate_limit(5, 'help')
async def bot_help(msg: types.Message):
text = [
'Список команд: ',
'/start - Начать диалог',
'/help - Получить справку'
]
await msg.answer('\n'.join(text))