mirror of
https://github.com/RafaelSolVargas/Vulkan.git
synced 2025-10-29 16:57:23 +00:00
Code style upgrade
This commit is contained in:
22
Handlers/ClearHandler.py
Normal file
22
Handlers/ClearHandler.py
Normal file
@@ -0,0 +1,22 @@
|
||||
from discord.ext.commands import Context
|
||||
from discord import Client
|
||||
from Handlers.AbstractHandler import AbstractHandler
|
||||
from Handlers.HandlerResponse import HandlerResponse
|
||||
from Parallelism.ProcessManager import ProcessManager
|
||||
|
||||
|
||||
class ClearHandler(AbstractHandler):
|
||||
def __init__(self, ctx: Context, bot: Client) -> None:
|
||||
super().__init__(ctx, bot)
|
||||
|
||||
async def run(self) -> HandlerResponse:
|
||||
# Get the current process of the guild
|
||||
processManager = ProcessManager()
|
||||
processContext = processManager.getRunningPlayerContext(self.guild)
|
||||
if processContext:
|
||||
# Clear the playlist
|
||||
playlist = processContext.getPlaylist()
|
||||
with processContext.getLock():
|
||||
playlist.clear()
|
||||
|
||||
return HandlerResponse(self.ctx)
|
||||
Reference in New Issue
Block a user