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

Check if we're already connected to a channel

This commit is contained in:
phxntxm 2017-04-19 22:43:24 -05:00
parent cf4fc12831
commit 40b4977a32

View file

@ -319,13 +319,19 @@ class Music:
perms = channel.permissions_for(ctx.message.guild.me)
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`")
await ctx.send("I do not have correct permissions in {}! Please turn on `connect`, `speak`, and `use "
"voice activation`".format(channel.name))
return
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
state = self.voice_states.get(ctx.message.guild.id)
if state:
await state.voice.move_to(channel)
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
@commands.command()
@commands.guild_only()