Check if we're already connected to a channel
This commit is contained in:
parent
cf4fc12831
commit
40b4977a32
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue