Add custom IDs for buttons

Kaveen Kumarasinghe 2 years ago
parent b9e4eae8d3
commit 2c82b226a3

@ -182,7 +182,7 @@ class DrawButton(discord.ui.Button["OptimizeView"]):
def __init__(
self, converser_cog, image_service_cog, deletion_queue, custom_api_key
):
super().__init__(style=discord.ButtonStyle.green, label="Draw")
super().__init__(style=discord.ButtonStyle.green, label="Draw", custom_id="draw_button_optimizer")
self.converser_cog = converser_cog
self.image_service_cog = image_service_cog
self.deletion_queue = deletion_queue
@ -237,7 +237,7 @@ class RedoButton(discord.ui.Button["OptimizeView"]):
def __init__(
self, converser_cog, image_service_cog, deletion_queue, custom_api_key=None
):
super().__init__(style=discord.ButtonStyle.danger, label="Retry")
super().__init__(style=discord.ButtonStyle.danger, label="Retry", custom_id="redo_button_optimizer")
self.converser_cog = converser_cog
self.image_service_cog = image_service_cog
self.deletion_queue = deletion_queue

@ -262,7 +262,7 @@ class SaveView(discord.ui.View):
class VaryButton(discord.ui.Button):
def __init__(self, number, image_url, cog, converser_cog, custom_api_key):
super().__init__(style=discord.ButtonStyle.blurple, label="Vary " + str(number))
super().__init__(style=discord.ButtonStyle.blurple, label="Vary " + str(number), custom_id="vary_button")
self.number = number
self.image_url = image_url
self.cog = cog
@ -318,7 +318,7 @@ class VaryButton(discord.ui.Button):
class SaveButton(discord.ui.Button["SaveView"]):
def __init__(self, number: int, image_url: str):
super().__init__(style=discord.ButtonStyle.gray, label="Save " + str(number))
super().__init__(style=discord.ButtonStyle.gray, label="Save " + str(number), custom_id="save_button")
self.number = number
self.image_url = image_url
@ -349,7 +349,7 @@ class SaveButton(discord.ui.Button["SaveView"]):
class RedoButton(discord.ui.Button["SaveView"]):
def __init__(self, cog, converser_cog, custom_api_key):
super().__init__(style=discord.ButtonStyle.danger, label="Retry")
super().__init__(style=discord.ButtonStyle.danger, label="Retry", custom_id="redo_button_draw_main")
self.cog = cog
self.converser_cog = converser_cog
self.custom_api_key = custom_api_key

@ -323,7 +323,7 @@ class ModerationAdminView(discord.ui.View):
class ApproveMessageButton(discord.ui.Button["ModerationAdminView"]):
def __init__(self, message, moderation_message, current_num):
super().__init__(style=discord.ButtonStyle.green, label="Approve")
super().__init__(style=discord.ButtonStyle.green, label="Approve", custom_id="approve_button")
self.message = message
self.moderation_message = moderation_message
self.current_num = current_num
@ -336,7 +336,7 @@ class ApproveMessageButton(discord.ui.Button["ModerationAdminView"]):
class DeleteMessageButton(discord.ui.Button["ModerationAdminView"]):
def __init__(self, message, moderation_message, current_num):
super().__init__(style=discord.ButtonStyle.danger, label="Delete Message")
super().__init__(style=discord.ButtonStyle.danger, label="Delete Message", custom_id="delete_button")
self.message = message
self.moderation_message = moderation_message
self.current_num = current_num
@ -361,7 +361,7 @@ class DeleteMessageButton(discord.ui.Button["ModerationAdminView"]):
class KickUserButton(discord.ui.Button["ModerationAdminView"]):
def __init__(self, message, moderation_message, current_num):
super().__init__(style=discord.ButtonStyle.danger, label="Kick User")
super().__init__(style=discord.ButtonStyle.danger, label="Kick User", custom_id="kick_button")
self.message = message
self.moderation_message = moderation_message
self.current_num = current_num
@ -400,7 +400,7 @@ class TimeoutUserButton(discord.ui.Button["ModerationAdminView"]):
def __init__(
self, message, moderation_message, current_num, hours, nodelete, source_deleted
):
super().__init__(style=discord.ButtonStyle.danger, label=f"Timeout {hours}h")
super().__init__(style=discord.ButtonStyle.danger, label=f"Timeout {hours}h", custom_id="timeout_button")
self.message = message
self.moderation_message = moderation_message
self.hours = hours

Loading…
Cancel
Save