Refactor ControlPanel to correctly retrieve associated text channel
Some checks are pending
Run pre-commit / Run pre-commit (push) Waiting to run
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:
parent
2dff13687d
commit
6e7092a4b2
1 changed files with 7 additions and 2 deletions
|
@ -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)
|
Loading…
Add table
Reference in a new issue