1
0
Fork 0
mirror of synced 2024-05-20 20:42:27 +12:00

Add a message for when connections timeout

This commit is contained in:
phxntxm 2017-05-03 20:12:13 -05:00
parent 7658241913
commit 67dd73c0af

View file

@ -298,18 +298,22 @@ class Music:
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 "
"voice activation`".format(channel.name))
return
return False
state = self.voice_states.get(ctx.message.guild.id)
if state and state.voice and state.voice.channel:
await state.voice.move_to(channel)
await ctx.send("Joined {} and ready to play".format(channel.name))
return True
else:
self.voice_states[ctx.message.guild.id] = VoiceState(ctx.message.guild, self.bot)
await channel.connect()
await ctx.send("Joined {} and ready to play".format(channel.name))
return True
try:
if state and state.voice and state.voice.channel:
await state.voice.move_to(channel)
await ctx.send("Joined {} and ready to play".format(channel.name))
return True
else:
self.voice_states[ctx.message.guild.id] = VoiceState(ctx.message.guild, self.bot)
await channel.connect()
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.guild_only()