diff --git a/Music-bot/cogs/music.py b/Music-bot/cogs/music.py index 23a2ed1e336d7e04fbc5ae5dfd1c73229d22da26..813d3c43504ba52036c440cdd4385efffede6077 100644 --- a/Music-bot/cogs/music.py +++ b/Music-bot/cogs/music.py @@ -426,7 +426,7 @@ class Music: await ctx.send(f'**`{ctx.author}`**: Set the volume to **{vol}%**') @commands.command(name='stop') - @checks.song_requester_or_owner_or_dj() + @checks.music_stop_check() async def stop_(self, ctx): """Stop the currently playing song and destroy the player. !Warning! diff --git a/Music-bot/cogs/utils/checks.py b/Music-bot/cogs/utils/checks.py index ab78f4eaa3f5c8c51dd187cfb69739a24160c315..1c7230b8b8b6e028e89695ea4e996d322fd7ed14 100644 --- a/Music-bot/cogs/utils/checks.py +++ b/Music-bot/cogs/utils/checks.py @@ -119,4 +119,25 @@ def song_requester_or_owner_or_dj(): f"permissions are not enough to use this command.") return False + return commands.check(predicate) + + +def music_stop_check(): + async def predicate(ctx): + is_owner = await ctx.bot.is_owner(ctx.author) + vc = ctx.voice_client + + if not vc or not vc.is_connected(): + await ctx.send('I am not currently connected to voice!') + + if ctx.message.author.name == vc.source.requester.name: + return True + elif is_owner: + return True + elif discord.utils.get(ctx.message.author.roles, name="DJ"): + return True + elif ctx.message.author != vc.source.requester or not discord.utils.get(ctx.message.author.roles, name="DJ"): + await ctx.send(f"You lack the permissions to use this command, sorry.") + return False + return commands.check(predicate) \ No newline at end of file