You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy reproducible code below, to a Cog listener. Replace the constants with your own, then join the channel. When you leave the channel, observe that an exception is thrown.
Minimal Reproducible Code
@commands.Cog.listener()asyncdefon_voice_state_update(self, member: discord.Member, before, after):
joined_channel_name=after.channel.nameifafter.channelelseNonetry:
ifbefore.channelandbefore.channel.idinself.created_channels:
iflen(before.channel.members) ==0:
awaitbefore.channel.delete()
delself.created_channels[before.channel.id]
returnifjoined_channel_name==CREATE_VC_CHANNEL_NAME:
new_channel=awaitmember.guild.create_voice_channel(
name=f"{member.display_name}'s Channel",
category=after.channel.category,
position=after.channel.position+1
)
awaitmember.move_to(new_channel)
self.created_channels[new_channel.id] =new_channelview=discord.ui.View()
view.add_item(ManageChannelButton())
awaitnew_channel.send(
f"Welcome to your new channel, {member.mention}!",
view=view
)
exceptExceptionase:
print(f"[create_vc] An error occurred: {e}")
Expected Results
I expected it to delete the channel, when no members are connected, without throwing an error.
Actual Results
Channel was deleted, error thrown.
Intents
All
System Information
Python v3.11.3-final
discord.py v2.4.0-final
aiohttp v3.11.11
system info: Windows 10 10.0.22631
Checklist
I have searched the open issues for duplicates.
I have shown the entire traceback, if possible.
I have removed my token from display, if visible.
Additional Context
No response
The text was updated successfully, but these errors were encountered:
Summary
Incorrectly Throwing Error for Channel Deletion
Reproduction Steps
Copy reproducible code below, to a Cog listener. Replace the constants with your own, then join the channel. When you leave the channel, observe that an exception is thrown.
Minimal Reproducible Code
Expected Results
I expected it to delete the channel, when no members are connected, without throwing an error.
Actual Results
Channel was deleted, error thrown.
Intents
All
System Information
Checklist
Additional Context
No response
The text was updated successfully, but these errors were encountered: