Modifying pause, resume and move commands to work with process

This commit is contained in:
Rafael Vargas
2022-07-23 00:37:11 -03:00
parent 1ce6deaa48
commit cd3eddb125
6 changed files with 72 additions and 47 deletions

View File

@@ -9,6 +9,7 @@ class VCommandsType(Enum):
RESUME = 'Resume'
CONTEXT = 'Context'
PLAY = 'Play'
STOP = 'Stop'
class VCommands:

View File

@@ -153,11 +153,24 @@ class PlayerProcess(Process):
self.__resume()
elif type == VCommandsType.SKIP:
self.__skip()
elif type == VCommandsType.STOP:
self.__loop.create_task(self.__stop())
else:
print(f'[ERROR] -> Unknown Command Received: {command}')
def __pause(self) -> None:
pass
if self.__guild.voice_client is not None:
if self.__guild.voice_client.is_playing():
self.__guild.voice_client.pause()
async def __stop(self) -> None:
if self.__guild.voice_client is not None:
if self.__guild.voice_client.is_connected():
with self.__lock:
self.__playlist.clear()
self.__playlist.loop_off()
self.__guild.voice_client.stop()
await self.__guild.voice_client.disconnect()
def __resume(self) -> None:
pass