-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
It takes a minute for the client to disconnect from voice channel, if bot is forcefully disconnected from voice channel. #9575
Comments
This will be fixed with #9525, as far as ambiguity is concerned. The default timeout on connect is currently 60 seconds, but the underlying cause is still probably on your side. |
But why is it trying to reconnect for 60secs? If it's disconnected forcefully then disconnect. |
That's just how long the timeout is. If it's a weird state issue this pr might fix it. |
Yupp should be a weird state issue, Even if I try to disconnect and connect, after forcefully disconnecting the bot (via disconnect button), I still get import discord
from discord.ext.commands import Bot
VOICE_CHANNEL_ID = ""
TOKEN = ""
PREFIX = "!"
DEVELOPER_INFO_MESSAGE = "If this error repeats, please snap a pic of this message and send it to the developer. They'll be happy to help you get back on track!"
intents = discord.Intents.default()
intents.message_content = True
intents.voice_states = True
bot = Bot(command_prefix=list(PREFIX), intents=intents)
@bot.event
async def on_ready():
#await add_help_command_with_embed(bot)
bot.player = await setup_player(bot)
print('Music Bot Ready')
async def setup_player(bot, disconnect = False):
if disconnect: await bot.player.disconnect()
voice_channel = await bot.fetch_channel(VOICE_CHANNEL_ID)
player = await voice_channel.connect()
return player
@bot.command(aliases=['r'])
async def reset(ctx):
"""
Give the radio a good ol' reset! Use this command if the radio isn't working for some reason.
"""
try:
ctx.bot.player = await setup_player(ctx.bot, True)
await ctx.send("Bot reconnected")
except Exception as e:
await ctx.send("Error: " + str(e))
bot.run(TOKEN) |
In that example you would want to use |
When trying to reconnect to a forcefully disconnected channel: Thks, you are really great developer. You can actually make sense of the code in this short period of time. If you gave it to me, i would certainly be slower. Thks |
Summary
The bot tried to reconnect to a voice channel for a minute before disconnecting from voice channel, if the bot is forcefully disconnected.
Reproduction Steps
voice_channel.connect()
you'll get errorError: Already connected to voice channel
.The logger shows
(Bot is forcefully disconnected via this button)
Minimal Reproducible Code
Expected Results
!r
command, and the bot should reconnectActual Results
The bot doesn't reconnect for 60-65 secs, after that it reconnect normally.
Intents
message_content, voice_states
System Information
❯ python -m discord -v
Checklist
Additional Context
No response
The text was updated successfully, but these errors were encountered: