mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 11:18:54 -05:00
[Audio] Fix [p]stop error when user is not in the channel (#480)
This commit is contained in:
parent
5acf2f8ec7
commit
fba3a079dd
@ -1714,8 +1714,7 @@ class Audio:
|
|||||||
reply += " (%d%% out of %d%% needed)" % (vote, thresh)
|
reply += " (%d%% out of %d%% needed)" % (vote, thresh)
|
||||||
await self.bot.reply(reply)
|
await self.bot.reply(reply)
|
||||||
else:
|
else:
|
||||||
await self.bot.reply("you aren't in the current playback"
|
await self.bot.say("You need to be in the voice channel to skip the music.")
|
||||||
" channel.")
|
|
||||||
else:
|
else:
|
||||||
await self.bot.say("Can't skip if I'm not playing.")
|
await self.bot.say("Can't skip if I'm not playing.")
|
||||||
|
|
||||||
@ -1732,6 +1731,7 @@ class Audio:
|
|||||||
is_admin = discord.utils.get(member.roles, name=admin_role) is not None
|
is_admin = discord.utils.get(member.roles, name=admin_role) is not None
|
||||||
is_mod = discord.utils.get(member.roles, name=mod_role) is not None
|
is_mod = discord.utils.get(member.roles, name=mod_role) is not None
|
||||||
|
|
||||||
|
|
||||||
nonbots = sum(not m.bot for m in member.voice_channel.voice_members)
|
nonbots = sum(not m.bot for m in member.voice_channel.voice_members)
|
||||||
alone = nonbots <= 1
|
alone = nonbots <= 1
|
||||||
|
|
||||||
@ -1786,13 +1786,16 @@ class Audio:
|
|||||||
"""Stops a currently playing song or playlist. CLEARS QUEUE."""
|
"""Stops a currently playing song or playlist. CLEARS QUEUE."""
|
||||||
server = ctx.message.server
|
server = ctx.message.server
|
||||||
if self.is_playing(server):
|
if self.is_playing(server):
|
||||||
if self.can_instaskip(ctx.message.author):
|
if ctx.message.author.voice_channel == server.me.voice_channel:
|
||||||
await self.bot.say('Stopping...')
|
if self.can_instaskip(ctx.message.author):
|
||||||
self._stop(server)
|
await self.bot.say('Stopping...')
|
||||||
|
self._stop(server)
|
||||||
|
else:
|
||||||
|
await self.bot.say("You can't stop music when there are other"
|
||||||
|
" people in the channel! Vote to skip"
|
||||||
|
" instead.")
|
||||||
else:
|
else:
|
||||||
await self.bot.say("You can't stop music when there are other"
|
await self.bot.say("You need to be in the voice channel to stop the music.")
|
||||||
" people in the channel! Vote to skip"
|
|
||||||
" instead.")
|
|
||||||
else:
|
else:
|
||||||
await self.bot.say("Can't stop if I'm not playing.")
|
await self.bot.say("Can't stop if I'm not playing.")
|
||||||
|
|
||||||
@ -2081,7 +2084,7 @@ def verify_ffmpeg_avconv():
|
|||||||
def setup(bot):
|
def setup(bot):
|
||||||
check_folders()
|
check_folders()
|
||||||
check_files()
|
check_files()
|
||||||
|
|
||||||
if youtube_dl is None:
|
if youtube_dl is None:
|
||||||
raise RuntimeError("You need to run `pip3 install youtube_dl`")
|
raise RuntimeError("You need to run `pip3 install youtube_dl`")
|
||||||
if opus is False:
|
if opus is False:
|
||||||
@ -2105,7 +2108,7 @@ def setup(bot):
|
|||||||
"and do ALL the steps in order.\n"
|
"and do ALL the steps in order.\n"
|
||||||
"https://twentysix26.github.io/Red-Docs/\n"
|
"https://twentysix26.github.io/Red-Docs/\n"
|
||||||
"".format(msg))
|
"".format(msg))
|
||||||
|
|
||||||
n = Audio(bot, player=player) # Praise 26
|
n = Audio(bot, player=player) # Praise 26
|
||||||
bot.add_cog(n)
|
bot.add_cog(n)
|
||||||
bot.add_listener(n.voice_state_update, 'on_voice_state_update')
|
bot.add_listener(n.voice_state_update, 'on_voice_state_update')
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user