Refactor ControlPanel to correctly retrieve associated text channel
Some checks are pending
Run pre-commit / Run pre-commit (push) Waiting to run

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.
This commit is contained in:
Valerie 2025-06-13 19:44:23 -04:00
parent 2dff13687d
commit 6e7092a4b2

View file

@ -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)
await self.config.channel(autoroom).message_id.set(message.id)