mirror of
https://github.com/RafaelSolVargas/Vulkan.git
synced 2025-10-29 16:57:23 +00:00
Adapting History, Loop, Now Playing, Remove, Shuffle and Reset commands to work with process
This commit is contained in:
@@ -2,19 +2,21 @@ from discord.ext.commands import Context
|
||||
from discord import Client
|
||||
from Handlers.AbstractHandler import AbstractHandler
|
||||
from Handlers.HandlerResponse import HandlerResponse
|
||||
from Handlers.PlayersController import PlayersController
|
||||
from Parallelism.ProcessManager import ProcessManager
|
||||
from Parallelism.Commands import VCommands, VCommandsType
|
||||
|
||||
|
||||
class ResetHandler(AbstractHandler):
|
||||
def __init__(self, ctx: Context, bot: Client) -> None:
|
||||
super().__init__(ctx, bot)
|
||||
self.__controller = PlayersController(self.bot)
|
||||
|
||||
async def run(self) -> HandlerResponse:
|
||||
try:
|
||||
await self.player.force_stop()
|
||||
await self.bot_member.move_to(None)
|
||||
self.__controller.reset_player(self.guild)
|
||||
return HandlerResponse(self.ctx)
|
||||
except Exception as e:
|
||||
print(f'DEVELOPER NOTE -> Reset Error: {e}')
|
||||
# Get the current process of the guild
|
||||
processManager = ProcessManager()
|
||||
processContext = processManager.getRunningPlayerContext(self.guild)
|
||||
if processContext:
|
||||
command = VCommands(VCommandsType.RESET, None)
|
||||
queue = processContext.getQueue()
|
||||
queue.put(command)
|
||||
|
||||
return HandlerResponse(self.ctx)
|
||||
|
||||
Reference in New Issue
Block a user