fix: Update button label to a visible character to comply with Discord API requirements

This commit is contained in:
Slipstream 2025-05-19 17:37:38 -06:00
parent 294292b7bc
commit 1048a631a4
Signed by: slipstream
GPG Key ID: 13E498CE010AC6FD

View File

@ -5,9 +5,9 @@ from typing import Optional, List
# --- Tic Tac Toe (Player vs Player) ---
class TicTacToeButton(ui.Button['TicTacToeView']):
def __init__(self, x: int, y: int):
# Use a space character for the initial label to avoid large buttons
# Empty string ('') is not allowed as per Discord API requirements
super().__init__(style=discord.ButtonStyle.secondary, label=' ', row=y)
# Use a visible character for the label as Discord API requires non-empty labels
# Empty string ('') or space character (' ') are not allowed as per Discord API requirements
super().__init__(style=discord.ButtonStyle.secondary, label='·', row=y)
self.x = x
self.y = y
@ -118,7 +118,7 @@ class TicTacToeView(ui.View):
# --- Tic Tac Toe Bot Game ---
class BotTicTacToeButton(ui.Button['BotTicTacToeView']):
def __init__(self, x: int, y: int):
super().__init__(style=discord.ButtonStyle.secondary, label=' ', row=y)
super().__init__(style=discord.ButtonStyle.secondary, label='·', row=y)
self.x = x
self.y = y
self.position = y * 3 + x # Convert to position index (0-8) for the TicTacToe engine