Skip to content

Commit

Permalink
collisions in ui_helper
Browse files Browse the repository at this point in the history
  • Loading branch information
squi-ddy authored Feb 27, 2024
1 parent 9e0b589 commit 72c712e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions bot/src/cogs/ui_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,14 @@ def register_callback(self, callback_name: str, callback: ButtonCallbackFactory)
self.callbacks[callback_name] = callback

def get_button(self, callback_name: str, callback_args: Collection[Any], **kwargs) -> Button:
button_id = uuid.uuid4().hex
while (button_id := uuid.uuid4().hex) in self.pending:
pass

self.pending[button_id] = (callback_name, callback_args)

kwargs["custom_id"] = button_id
button = Button(**kwargs)

self.pending[button_id] = (callback_name, callback_args)

return button

@Cog.listener()
Expand Down

0 comments on commit 72c712e

Please sign in to comment.