mirror of
https://github.com/RafaelSolVargas/Vulkan.git
synced 2025-10-29 16:57:23 +00:00
26 lines
969 B
Python
26 lines
969 B
Python
from discord.ext.commands import Context
|
|
from Handlers.AbstractHandler import AbstractHandler
|
|
from Handlers.HandlerResponse import HandlerResponse
|
|
from Parallelism.ProcessManager import ProcessManager
|
|
from Parallelism.Commands import VCommands, VCommandsType
|
|
from Music.MusicBot import VulkanBot
|
|
|
|
|
|
class PauseHandler(AbstractHandler):
|
|
def __init__(self, ctx: Context, bot: VulkanBot) -> None:
|
|
super().__init__(ctx, bot)
|
|
|
|
async def run(self) -> HandlerResponse:
|
|
processManager = ProcessManager()
|
|
processInfo = processManager.getRunningPlayerInfo(self.guild)
|
|
if processInfo:
|
|
# Send Pause command to be execute by player process
|
|
command = VCommands(VCommandsType.PAUSE, None)
|
|
queue = processInfo.getQueue()
|
|
queue.put(command)
|
|
|
|
return HandlerResponse(self.ctx)
|
|
else:
|
|
embed = self.embeds.NOT_PLAYING()
|
|
return HandlerResponse(self.ctx, embed)
|