Add a message for when connections timeout
This commit is contained in:
parent
7658241913
commit
67dd73c0af
|
@ -298,18 +298,22 @@ class Music:
|
||||||
if not perms.connect or not perms.speak or not perms.use_voice_activation:
|
if not perms.connect or not perms.speak or not perms.use_voice_activation:
|
||||||
await ctx.send("I do not have correct permissions in {}! Please turn on `connect`, `speak`, and `use "
|
await ctx.send("I do not have correct permissions in {}! Please turn on `connect`, `speak`, and `use "
|
||||||
"voice activation`".format(channel.name))
|
"voice activation`".format(channel.name))
|
||||||
return
|
return False
|
||||||
|
|
||||||
state = self.voice_states.get(ctx.message.guild.id)
|
state = self.voice_states.get(ctx.message.guild.id)
|
||||||
if state and state.voice and state.voice.channel:
|
try:
|
||||||
await state.voice.move_to(channel)
|
if state and state.voice and state.voice.channel:
|
||||||
await ctx.send("Joined {} and ready to play".format(channel.name))
|
await state.voice.move_to(channel)
|
||||||
return True
|
await ctx.send("Joined {} and ready to play".format(channel.name))
|
||||||
else:
|
return True
|
||||||
self.voice_states[ctx.message.guild.id] = VoiceState(ctx.message.guild, self.bot)
|
else:
|
||||||
await channel.connect()
|
self.voice_states[ctx.message.guild.id] = VoiceState(ctx.message.guild, self.bot)
|
||||||
await ctx.send("Joined {} and ready to play".format(channel.name))
|
await channel.connect()
|
||||||
return True
|
await ctx.send("Joined {} and ready to play".format(channel.name))
|
||||||
|
return True
|
||||||
|
except asyncio.TimeoutError:
|
||||||
|
await ctx.send("Sorry, but I couldn't connect right now! Please try again later")
|
||||||
|
return False
|
||||||
|
|
||||||
@commands.command()
|
@commands.command()
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
|
|
Loading…
Reference in a new issue