fix(commands/voice/queue): lock when queue_or_play
This commit is contained in:
parent
73c1ebf9ee
commit
393403ef7d
@ -63,7 +63,7 @@ async def queue_or_play(message):
|
||||
not message.guild.voice_client.is_playing()
|
||||
and not message.guild.voice_client.is_paused()
|
||||
):
|
||||
await message.channel.send(f"**now playing:** `{player.title}`")
|
||||
await utils.reply(message, f"**now playing:** `{player.title}`")
|
||||
play_next(message)
|
||||
else:
|
||||
await utils.reply(
|
||||
|
7
core.py
7
core.py
@ -1,3 +1,4 @@
|
||||
import asyncio
|
||||
import contextlib
|
||||
import importlib
|
||||
import inspect
|
||||
@ -11,6 +12,7 @@ import commands
|
||||
import constants
|
||||
import core
|
||||
import utils
|
||||
from state import command_locks
|
||||
|
||||
|
||||
async def on_message(message):
|
||||
@ -93,7 +95,10 @@ async def on_message(message):
|
||||
case C.LEAVE:
|
||||
await commands.voice.leave(message)
|
||||
case C.QUEUE | C.PLAY:
|
||||
await commands.voice.queue_or_play(message)
|
||||
if message.guild.id not in command_locks:
|
||||
command_locks[message.guild.id] = asyncio.Lock()
|
||||
async with command_locks[message.guild.id]:
|
||||
await commands.voice.queue_or_play(message)
|
||||
case C.SKIP:
|
||||
await commands.voice.skip(message)
|
||||
case C.RESUME:
|
||||
|
Loading…
x
Reference in New Issue
Block a user