From 6e7092a4b23a4780827f361ffaaf7276adf73b15 Mon Sep 17 00:00:00 2001 From: Valerie Date: Fri, 13 Jun 2025 19:44:23 -0400 Subject: [PATCH] Refactor ControlPanel to correctly retrieve associated text channel This update modifies the ControlPanel class to ensure the correct text channel is retrieved based on the AutoRoom name, enhancing the reliability of message sending. Additionally, it updates the configuration reference for storing message IDs, improving overall clarity and functionality in channel interactions. --- autoroom/control_panel.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/autoroom/control_panel.py b/autoroom/control_panel.py index 50a96da..1cafbc3 100644 --- a/autoroom/control_panel.py +++ b/autoroom/control_panel.py @@ -206,7 +206,12 @@ class ControlPanel: return # Get the associated text channel - text_channel = autoroom.guild.get_channel(autoroom.id) + text_channel = None + for channel in autoroom.guild.text_channels: + if channel.name == autoroom.name: + text_channel = channel + break + if not text_channel: return @@ -230,4 +235,4 @@ class ControlPanel: # Send the embed to the text channel message = await text_channel.send(embed=embed, view=view) # Store the message ID for reference - await self.config.channel(autoroom).control_panel_message_id.set(message.id) \ No newline at end of file + await self.config.channel(autoroom).message_id.set(message.id) \ No newline at end of file