mirror of
https://github.com/RafaelSolVargas/Vulkan.git
synced 2025-10-29 16:57:23 +00:00
Stability Commit with connections to Discord user
This commit is contained in:
parent
63d86e23f9
commit
5312a729e9
@ -16,7 +16,10 @@ class Music(commands.Cog):
|
||||
async def on_ready(self) -> None:
|
||||
"""Load a player for each guild that the Bot are"""
|
||||
for guild in self.__bot.guilds:
|
||||
self.__guilds[guild] = Player(self.__bot, guild)
|
||||
player = Player(self.__bot, guild)
|
||||
await player.force_stop()
|
||||
self.__guilds[guild] = player
|
||||
|
||||
print(f'Player for guild {guild.name} created')
|
||||
|
||||
@commands.Cog.listener()
|
||||
@ -175,10 +178,18 @@ class Music(commands.Cog):
|
||||
@commands.command(name='reset', help=help.HELP_RESET, description=help.HELP_RESET_LONG, aliases=['resetar'])
|
||||
async def reset(self, ctx) -> None:
|
||||
player = self.__get_player(ctx)
|
||||
if player != None:
|
||||
try:
|
||||
await player.force_stop()
|
||||
await player.stop()
|
||||
self.__guilds[ctx.guild] = Player(self.__bot, ctx.guild)
|
||||
player = self.__get_player(ctx)
|
||||
player.force_stop()
|
||||
except Exception as e:
|
||||
print('Reset Error: {e}')
|
||||
|
||||
self.__guilds[ctx.guild] = Player(self.__bot, ctx.guild)
|
||||
player = self.__get_player(ctx)
|
||||
print(f'Player for guild {ctx.guild} created')
|
||||
|
||||
async def __send_embed(self, ctx, title='', description='', colour='grey') -> None:
|
||||
try:
|
||||
|
||||
@ -244,6 +244,15 @@ class Player(commands.Cog):
|
||||
await self.__guild.voice_client.disconnect()
|
||||
return True
|
||||
|
||||
async def force_stop(self) -> None:
|
||||
try:
|
||||
self.__guild.voice_client.stop()
|
||||
await self.__guild.voice_client.disconnect()
|
||||
self.__playlist.clear()
|
||||
self.__playlist.loop_off()
|
||||
except Exception as e:
|
||||
print(f'Force Stop Error: {e}')
|
||||
|
||||
async def pause(self) -> bool:
|
||||
if self.__guild.voice_client == None:
|
||||
return False
|
||||
@ -339,7 +348,7 @@ class Player(commands.Cog):
|
||||
result = self.__playlist.remove_song(position)
|
||||
return result
|
||||
|
||||
def __format_embed(self, info=dict, title='', position='Playing Now') -> discord.Embed:
|
||||
def __format_embed(self, info: dict, title='', position='Playing Now') -> discord.Embed:
|
||||
"""Configure the embed to show the song information"""
|
||||
embedvc = discord.Embed(
|
||||
title=title,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user