add support of no argument in dp.throttled

This commit is contained in:
birdi 2019-08-03 18:39:54 +03:00
parent 0c715add94
commit 288c7099b0
2 changed files with 2 additions and 2 deletions

View file

@ -1031,7 +1031,7 @@ class Dispatcher(DataMixin, ContextInstanceMixin):
return self.async_task(callback) return self.async_task(callback)
return callback return callback
def throttled(self, on_throttled: typing.Callable, *, def throttled(self, on_throttled: typing.Optional[typing.Callable] = None,
key=None, rate=None, key=None, rate=None,
user_id=None, chat_id=None): user_id=None, chat_id=None):
""" """

View file

@ -61,7 +61,7 @@ async def say_hello(message: types.Message):
@dp.message_handler(commands=['help']) @dp.message_handler(commands=['help'])
@dp.throttled(None, rate=5) @dp.throttled(rate=5)
# nothing will happen if the handler will be throttled # nothing will happen if the handler will be throttled
async def help_handler(message: types.Message): async def help_handler(message: types.Message):
await message.answer('Help!') await message.answer('Help!')