From 10b08264e4ba517a2479f80f9f5a3cf53e6b462c Mon Sep 17 00:00:00 2001
From: Marc Di Luzio <marc.diluzio@gmail.com>
Date: Sun, 11 Aug 2024 19:04:43 +0100
Subject: [PATCH] Ensure we properly version the button custom ID

---
 py/matchy.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/py/matchy.py b/py/matchy.py
index c352f53..ffd8c6e 100755
--- a/py/matchy.py
+++ b/py/matchy.py
@@ -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
-_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],
-                         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:
         super().__init__(
             discord.ui.Button(
                 label='Match Groups!',
                 style=discord.ButtonStyle.blurple,
-                custom_id=f'match:min:{min}',
+                custom_id=_MATCH_BUTTON_CUSTOM_ID_PREFIX + f'min:{min}',
             )
         )
         self.min: int = min