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
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:
parent
6e7092a4b2
commit
628f2dae90
3 changed files with 11 additions and 4 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue