Ensure we properly version the button custom ID
This commit is contained in:
parent
29d40cd80f
commit
10b08264e4
1 changed files with 4 additions and 3 deletions
|
@ -160,17 +160,18 @@ async def match(interaction: discord.Interaction, members_min: int = None):
|
||||||
|
|
||||||
|
|
||||||
# Increment when adjusting the custom_id so we don't confuse old users
|
# Increment when adjusting the custom_id so we don't confuse old users
|
||||||
_BUTTON_CUSTOM_ID_VERSION = 1
|
_MATCH_BUTTON_CUSTOM_ID_VERSION = 1
|
||||||
|
_MATCH_BUTTON_CUSTOM_ID_PREFIX = f'match:v{_MATCH_BUTTON_CUSTOM_ID_VERSION}:'
|
||||||
|
|
||||||
|
|
||||||
class DynamicGroupButton(discord.ui.DynamicItem[discord.ui.Button],
|
class DynamicGroupButton(discord.ui.DynamicItem[discord.ui.Button],
|
||||||
template=f'match:v{_BUTTON_CUSTOM_ID_VERSION}:' + r'min:(?P<min>[0-9]+)'):
|
template=_MATCH_BUTTON_CUSTOM_ID_PREFIX + r'min:(?P<min>[0-9]+)'):
|
||||||
def __init__(self, min: int) -> None:
|
def __init__(self, min: int) -> None:
|
||||||
super().__init__(
|
super().__init__(
|
||||||
discord.ui.Button(
|
discord.ui.Button(
|
||||||
label='Match Groups!',
|
label='Match Groups!',
|
||||||
style=discord.ButtonStyle.blurple,
|
style=discord.ButtonStyle.blurple,
|
||||||
custom_id=f'match:min:{min}',
|
custom_id=_MATCH_BUTTON_CUSTOM_ID_PREFIX + f'min:{min}',
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
self.min: int = min
|
self.min: int = min
|
||||||
|
|
Loading…
Add table
Reference in a new issue