mirror of
https://github.com/weyne85/discord_music_bot.git
synced 2025-10-29 16:58:27 +00:00
Continuing the refactoring
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
from abc import ABC, abstractmethod
|
||||
from threading import Lock
|
||||
from typing import Union
|
||||
from discord.ext.commands import Context
|
||||
from discord import Guild, Interaction
|
||||
from Music.Playlist import Playlist
|
||||
from Music.Song import Song
|
||||
from Parallelism.ProcessInfo import PlayerInfo
|
||||
from Parallelism.Commands import VCommands
|
||||
|
||||
|
||||
class AbstractPlayersManager(ABC):
|
||||
@@ -11,19 +13,33 @@ class AbstractPlayersManager(ABC):
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def setPlayerInfo(self, guild: Guild, info: PlayerInfo):
|
||||
def sendCommandToPlayer(self, command: VCommands, guild: Guild, forceCreation: bool = False, context: Union[Context, Interaction] = None):
|
||||
"""If the forceCreation boolean is True, then the context must be provided for the Player to be created"""
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def getOrCreatePlayerInfo(self, guild: Guild, context: Union[Context, Interaction]) -> PlayerInfo:
|
||||
def getPlayerPlaylist(self, guild: Guild) -> Playlist:
|
||||
"""If there is a player process for the guild, then return the playlist of the guild"""
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def resetProcess(self, guild: Guild, context: Context) -> None:
|
||||
def getPlayerLock(self, guild: Guild) -> Lock:
|
||||
"""If there is a player process for the guild, then return the lock of the guild"""
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def getRunningPlayerInfo(self, guild: Guild) -> PlayerInfo:
|
||||
def verifyIfPlayerExists(self, guild: Guild) -> bool:
|
||||
"""Returns if a player for the guild exists"""
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def createPlayerForGuild(self, guild: Guild, context: Union[Context, Interaction]) -> None:
|
||||
"""With the context information of a guild create a internal player for the guild"""
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def resetPlayer(self, guild: Guild, context: Context) -> None:
|
||||
"""Tries to reset the player of the guild"""
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
|
||||
Reference in New Issue
Block a user