mirror of
https://github.com/RafaelSolVargas/Vulkan.git
synced 2025-10-29 16:57:23 +00:00
Continuing the refactoring
This commit is contained in:
@@ -3,7 +3,6 @@ from Handlers.AbstractHandler import AbstractHandler
|
||||
from Handlers.HandlerResponse import HandlerResponse
|
||||
from Music.VulkanBot import VulkanBot
|
||||
from Parallelism.AbstractProcessManager import AbstractPlayersManager
|
||||
from Parallelism.ProcessInfo import PlayerInfo, ProcessStatus
|
||||
from Parallelism.Commands import VCommands, VCommandsType
|
||||
from typing import Union
|
||||
from discord import Interaction
|
||||
@@ -14,18 +13,10 @@ class StopHandler(AbstractHandler):
|
||||
super().__init__(ctx, bot)
|
||||
|
||||
async def run(self) -> HandlerResponse:
|
||||
processManager: AbstractPlayersManager = self.config.getPlayersManager()
|
||||
processInfo = processManager.getRunningPlayerInfo(self.guild)
|
||||
if processInfo:
|
||||
if processInfo.getStatus() == ProcessStatus.SLEEPING:
|
||||
embed = self.embeds.NOT_PLAYING()
|
||||
return HandlerResponse(self.ctx, embed)
|
||||
|
||||
# Send command to player process stop
|
||||
playersManager: AbstractPlayersManager = self.config.getPlayersManager()
|
||||
if playersManager.verifyIfPlayerExists(self.guild):
|
||||
command = VCommands(VCommandsType.STOP, None)
|
||||
queue = processInfo.getQueueToPlayer()
|
||||
self.putCommandInQueue(queue, command)
|
||||
|
||||
playersManager.sendCommandToPlayer(command, self.guild)
|
||||
embed = self.embeds.STOPPING_PLAYER()
|
||||
return HandlerResponse(self.ctx, embed)
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user