Fixed some bugs

This commit is contained in:
Choco
2024-09-07 13:08:28 +08:00
parent b26d7af14b
commit f58deb2f8b
5 changed files with 16 additions and 9 deletions

1
.github/FUNDING.yml vendored Normal file
View File

@@ -0,0 +1 @@
ko_fi: chocoo

View File

@@ -195,18 +195,18 @@ class Playlists(commands.Cog, name="playlist"):
text = await get_lang(ctx.guild.id, "playlistViewTitle", "playlistViewHeaders", "playlistFooter")
embed = discord.Embed(
title=text[0].format(ctx.author.display_name),
description='```prolog\n %4s %10s %10s %10s\n' % tuple(text[1].split(",")),
description='```prolog\n %4s %10s %12s %10s\n' % tuple(text[1].split(",")),
color=settings.embed_color
)
for index in range(max_p):
try:
info = results[index]
track_info = (info['emoji'], info['id'], f"[{info['time']}]", info['name'], f"{len(info['tracks'])}/{max_t}")
track_info = (info['emoji'], info['id'], f"[{info['time']}]", info['name'], f"{len(info['tracks'])}")
except IndexError:
track_info = ("🎵", "-"*3, "[--:--]", "-"*6, f"-/{max_t}")
track_info = ("🎵", "-"*3, "[--:--]", "-"*6, f"-")
embed.description += '%0s %3s. %10s %10s %10s\n' % track_info
embed.description += '%0s %3s. %10s %12s %10s\n' % track_info
embed.description += "```"
embed.set_footer(text=text[2])

View File

@@ -64,7 +64,7 @@ class IPCClient:
self._bot.loop.create_task(process_methods(self, self._bot, msg.json()))
async def send(self, data: dict):
if self._is_connected:
if self.is_connected:
self._logger.debug(f"Send Message: {data}")
await self._websocket.send_json(data)
@@ -103,4 +103,8 @@ class IPCClient:
async def disconnect(self) -> None:
self._is_connected = False
self._task.cancel()
self._logger.info("Disconnected to dashboard!")
self._logger.info("Disconnected to dashboard!")
@property
def is_connected(self) -> bool:
return self._is_connected

View File

@@ -18,7 +18,8 @@ SCOPES = {
"24/7": bool,
"votedisable": bool,
"duplicateTrack": bool,
"default_controller": dict
"default_controller": dict,
"stage_announce_template": str
}
class TempCtx():

View File

@@ -69,8 +69,9 @@ async def connect_channel(ctx: Union[commands.Context, Interaction], channel: Vo
ctx.bot if isinstance(ctx, commands.Context) else ctx.client,
channel, ctx, settings
))
await player.send_ws({"op": "createPlayer", "member_ids": [member.id for member in channel.members]})
if ctx.bot.ipc.is_connected:
await player.send_ws({"op": "createPlayer", "member_ids": [str(member.id) for member in channel.members]})
return player