Add message ID fields and refactor text channel retrieval in AutoRoom
Some checks are pending
Run pre-commit / Run pre-commit (push) Waiting to run

This update introduces two new fields for message IDs in the AutoRoom class, enhancing the tracking of messages related to the autoroom functionality. Additionally, the text channel retrieval logic has been refactored in both the ControlPanel and WaitingRoom classes to use the voice channel's ID, improving accuracy and reliability in channel interactions.
This commit is contained in:
Valerie 2025-06-13 19:57:44 -04:00
parent 6e7092a4b2
commit 628f2dae90
3 changed files with 11 additions and 4 deletions

View file

@ -68,6 +68,8 @@ class AutoRoom(
"owner": None, "owner": None,
"associated_text_channel": None, "associated_text_channel": None,
"denied": [], "denied": [],
"message_id": None,
"waiting_room_message_id": None,
} }
extra_channel_name_change_delay = 4 extra_channel_name_change_delay = 4

View file

@ -205,10 +205,10 @@ class ControlPanel:
if not owner: if not owner:
return return
# Get the associated text channel # Get the associated text channel using the voice channel's ID
text_channel = None text_channel = None
for channel in autoroom.guild.text_channels: for channel in autoroom.guild.text_channels:
if channel.name == autoroom.name: if channel.id == autoroom.id:
text_channel = channel text_channel = channel
break break

View file

@ -141,8 +141,13 @@ class WaitingRoom:
if not autoroom_info: if not autoroom_info:
return return
# Get the voice channel's text chat # Get the voice channel's text chat using the voice channel's ID
text_channel = autoroom.guild.get_channel(autoroom.id) text_channel = None
for channel in autoroom.guild.text_channels:
if channel.id == autoroom.id:
text_channel = channel
break
if not text_channel: if not text_channel:
return return