Добавлены миддлвари на примере ThrottlingMiddleware
This commit is contained in:
@@ -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
13
handlers/user/help.py
Normal 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))
|
||||
Reference in New Issue
Block a user