diff --git a/commands/voice.py b/commands/voice.py index 09817ca..9c8d86e 100644 --- a/commands/voice.py +++ b/commands/voice.py @@ -11,7 +11,7 @@ import youtubedl from state import client, players -async def queue_or_play(message): +async def queue_or_play(message, edited=False): await ensure_joined(message) if not command_allowed(message): return @@ -73,6 +73,15 @@ async def queue_or_play(message): if not (args := await parser.parse_args(message, tokens)): return + if edited: + found = None + for queued in players[message.guild.id].queue: + if queued.trigger_message.id == message.id: + found = queued + break + if found: + players[message.guild.id].queue.remove(found) + if args.clear: players[message.guild.id].queue.clear() await utils.add_check_reaction(message) diff --git a/core.py b/core.py index 6e91be7..f67373a 100644 --- a/core.py +++ b/core.py @@ -15,7 +15,7 @@ import utils from state import client, command_locks, executed_messages -async def on_message(message): +async def on_message(message, edited=False): if not message.content.startswith(constants.PREFIX) or message.author.bot: return @@ -105,7 +105,7 @@ async def on_message(message): await commands.voice.leave(message) case C.QUEUE | C.PLAY: async with command_locks[message.guild.id]: - await commands.voice.queue_or_play(message) + await commands.voice.queue_or_play(message, edited=True) case C.SKIP: async with command_locks[message.guild.id]: await commands.voice.skip(message) diff --git a/events.py b/events.py index b358fd6..3655075 100644 --- a/events.py +++ b/events.py @@ -28,7 +28,7 @@ async def on_message_edit(before, after): if before.content == after.content: return - await core.on_message(after) + await core.on_message(after, edited=True) async def on_voice_state_update(member, before, after):