mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Fix empty bucket return
When trying to implement throttling for commands "hr = await dispatcher.check_key(key)" without other parameters it couldn't find any bucket
This commit is contained in:
parent
9de257efec
commit
9f23c739be
1 changed files with 4 additions and 4 deletions
|
|
@ -1136,8 +1136,8 @@ class Dispatcher(DataMixin, ContextInstanceMixin):
|
|||
raise RuntimeError('This storage does not provide Leaky Bucket')
|
||||
|
||||
if user_id is None and chat_id is None:
|
||||
user_id = types.User.get_current()
|
||||
chat_id = types.Chat.get_current()
|
||||
user_id = types.User.get_current().id
|
||||
chat_id = types.Chat.get_current().id
|
||||
|
||||
bucket = await self.storage.get_bucket(chat=chat_id, user=user_id)
|
||||
data = bucket.get(key, {})
|
||||
|
|
@ -1158,8 +1158,8 @@ class Dispatcher(DataMixin, ContextInstanceMixin):
|
|||
raise RuntimeError('This storage does not provide Leaky Bucket')
|
||||
|
||||
if user_id is None and chat_id is None:
|
||||
user_id = types.User.get_current()
|
||||
chat_id = types.Chat.get_current()
|
||||
user_id = types.User.get_current().id
|
||||
chat_id = types.Chat.get_current().id
|
||||
|
||||
bucket = await self.storage.get_bucket(chat=chat_id, user=user_id)
|
||||
if bucket and key in bucket:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue