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:
@@ -3,6 +3,7 @@ from discord import Client
|
||||
from Handlers.AbstractHandler import AbstractHandler
|
||||
from Handlers.HandlerResponse import HandlerResponse
|
||||
from Utils.Utils import Utils
|
||||
from Parallelism.ProcessManager import ProcessManager
|
||||
|
||||
|
||||
class HistoryHandler(AbstractHandler):
|
||||
@@ -10,11 +11,18 @@ class HistoryHandler(AbstractHandler):
|
||||
super().__init__(ctx, bot)
|
||||
|
||||
async def run(self) -> HandlerResponse:
|
||||
history = self.player.playlist.getSongsHistory()
|
||||
# Get the current process of the guild
|
||||
processManager = ProcessManager()
|
||||
processContext = processManager.getRunningPlayerContext(self.guild)
|
||||
if processContext:
|
||||
with processContext.getLock():
|
||||
playlist = processContext.getPlaylist()
|
||||
history = playlist.getSongsHistory()
|
||||
else:
|
||||
history = []
|
||||
|
||||
if len(history) == 0:
|
||||
text = self.messages.HISTORY_EMPTY
|
||||
|
||||
else:
|
||||
text = f'\n📜 History Length: {len(history)} | Max: {self.config.MAX_SONGS_HISTORY}\n'
|
||||
for pos, song in enumerate(history, start=1):
|
||||
|
||||
Reference in New Issue
Block a user