Adding new controllers

This commit is contained in:
Rafael Vargas
2022-03-23 13:48:01 -04:00
parent a828350201
commit fd1e58211b
18 changed files with 328 additions and 133 deletions

View File

@@ -0,0 +1,23 @@
from discord.ext.commands import Context
from discord import Client
from Controllers.AbstractController import AbstractController
from Controllers.ControllerResponse import ControllerResponse
class StopController(AbstractController):
def __init__(self, ctx: Context, bot: Client) -> None:
super().__init__(ctx, bot)
async def run(self) -> ControllerResponse:
if self.guild.voice_client is None:
return ControllerResponse(self.ctx)
if self.guild.voice_client.is_connected():
self.player.playlist.clear()
self.player.playlist.loop_off()
self.guild.voice_client.stop()
await self.guild.voice_client.disconnect()
return ControllerResponse(self.ctx)