diff --git a/aiogram/dispatcher/dispatcher.py b/aiogram/dispatcher/dispatcher.py index 9948c119..199db1d2 100644 --- a/aiogram/dispatcher/dispatcher.py +++ b/aiogram/dispatcher/dispatcher.py @@ -1031,7 +1031,7 @@ class Dispatcher(DataMixin, ContextInstanceMixin): return self.async_task(callback) return callback - def throttled(self, on_throttled: typing.Callable, *, + def throttled(self, on_throttled: typing.Optional[typing.Callable] = None, key=None, rate=None, user_id=None, chat_id=None): """ diff --git a/examples/throttling_example.py b/examples/throttling_example.py index 3b2fe8cd..3c780974 100644 --- a/examples/throttling_example.py +++ b/examples/throttling_example.py @@ -61,7 +61,7 @@ async def say_hello(message: types.Message): @dp.message_handler(commands=['help']) -@dp.throttled(None, rate=5) +@dp.throttled(rate=5) # nothing will happen if the handler will be throttled async def help_handler(message: types.Message): await message.answer('Help!')