diff options
| author | Rapptz <[email protected]> | 2021-06-12 02:33:11 -0400 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2021-06-12 02:33:11 -0400 |
| commit | 1c640ad72be4582bb32f659924d009c6d97b77ea (patch) | |
| tree | dc44c52cf59d6511da8e4e4e37b31bfca2bc56b3 /discord/ui/button.py | |
| parent | Fix guild documentation not showing up for some methods (diff) | |
| download | discord.py-1c640ad72be4582bb32f659924d009c6d97b77ea.tar.xz discord.py-1c640ad72be4582bb32f659924d009c6d97b77ea.zip | |
Lazily create Button custom_ids in decorator interface
The previous code would make two separate instances share the custom_id
which might have been undesirable behaviour
Diffstat (limited to 'discord/ui/button.py')
| -rw-r--r-- | discord/ui/button.py | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/discord/ui/button.py b/discord/ui/button.py index 7dccfd15..741b262c 100644 --- a/discord/ui/button.py +++ b/discord/ui/button.py @@ -267,11 +267,9 @@ def button( """ def decorator(func: ItemCallbackType) -> ItemCallbackType: - nonlocal custom_id if not inspect.iscoroutinefunction(func): raise TypeError('button function must be a coroutine function') - custom_id = custom_id or os.urandom(32).hex() func.__discord_ui_model_type__ = Button func.__discord_ui_model_kwargs__ = { 'style': style, |