From 628f2dae907921e4615693a440ead7ca00145459 Mon Sep 17 00:00:00 2001 From: Valerie Date: Fri, 13 Jun 2025 19:57:44 -0400 Subject: [PATCH] Add message ID fields and refactor text channel retrieval in AutoRoom 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. --- autoroom/autoroom.py | 2 ++ autoroom/control_panel.py | 4 ++-- autoroom/waiting_room.py | 9 +++++++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/autoroom/autoroom.py b/autoroom/autoroom.py index 0baf195..98cb49f 100644 --- a/autoroom/autoroom.py +++ b/autoroom/autoroom.py @@ -68,6 +68,8 @@ class AutoRoom( "owner": None, "associated_text_channel": None, "denied": [], + "message_id": None, + "waiting_room_message_id": None, } extra_channel_name_change_delay = 4 diff --git a/autoroom/control_panel.py b/autoroom/control_panel.py index 1cafbc3..57bbbd1 100644 --- a/autoroom/control_panel.py +++ b/autoroom/control_panel.py @@ -205,10 +205,10 @@ class ControlPanel: if not owner: return - # Get the associated text channel + # Get the associated text channel using the voice channel's ID text_channel = None for channel in autoroom.guild.text_channels: - if channel.name == autoroom.name: + if channel.id == autoroom.id: text_channel = channel break diff --git a/autoroom/waiting_room.py b/autoroom/waiting_room.py index d3edb2e..2c1128f 100644 --- a/autoroom/waiting_room.py +++ b/autoroom/waiting_room.py @@ -141,8 +141,13 @@ class WaitingRoom: if not autoroom_info: return - # Get the voice channel's text chat - text_channel = autoroom.guild.get_channel(autoroom.id) + # Get the voice channel's text chat using the voice channel's ID + text_channel = None + for channel in autoroom.guild.text_channels: + if channel.id == autoroom.id: + text_channel = channel + break + if not text_channel: return