Fixed some bugs
This commit is contained in:
@@ -779,6 +779,5 @@ class Basic(commands.Cog):
|
||||
|
||||
await ctx.send(embed=embed)
|
||||
|
||||
|
||||
async def setup(bot: commands.Bot) -> None:
|
||||
await bot.add_cog(Basic(bot))
|
||||
|
||||
@@ -386,7 +386,9 @@ class Playlists(commands.Cog, name="playlist"):
|
||||
return await ctx.send(get_lang(ctx.guild.id, 'playlistPositionNotFound').format(position, name))
|
||||
|
||||
await update_playlist(ctx.author.id, {f'playlist.{result["id"]}.tracks': result['playlist']['tracks'][position - 1]}, pull=True, mode=False)
|
||||
await ctx.send(get_lang(ctx.guild.id, 'playlistRemoved').format(result['playlist']['tracks'][position - 1]['info']['title'], ctx.author, name))
|
||||
|
||||
track = voicelink.decode(result['playlist']['tracks'][position - 1])
|
||||
await ctx.send(get_lang(ctx.guild.id, 'playlistRemoved').format(track.get("title"), ctx.author, name))
|
||||
|
||||
@playlist.command(name="clear", aliases=get_aliases("clear"))
|
||||
@commands.dynamic_cooldown(cooldown_check, commands.BucketType.guild)
|
||||
@@ -405,6 +407,5 @@ class Playlists(commands.Cog, name="playlist"):
|
||||
await update_playlist(ctx.author.id, {f'playlist.{result["id"]}.tracks': []})
|
||||
await ctx.send(get_lang(ctx.guild.id, 'playlistClear').format(name))
|
||||
|
||||
|
||||
async def setup(bot: commands.Bot) -> None:
|
||||
await bot.add_cog(Playlists(bot))
|
||||
|
||||
4
main.py
4
main.py
@@ -64,8 +64,8 @@ class Vocard(commands.Bot):
|
||||
if not func.settings.version or func.settings.version != update.__version__:
|
||||
func.update_json(func.root_dir + "/settings.json", new_data={"version": update.__version__})
|
||||
|
||||
await bot.tree.set_translator(Translator())
|
||||
await bot.tree.sync()
|
||||
await self.tree.set_translator(Translator())
|
||||
await self.tree.sync()
|
||||
|
||||
async def on_ready(self):
|
||||
print("------------------")
|
||||
|
||||
@@ -180,7 +180,7 @@ class TrackDecoder:
|
||||
"identifier": body_reader.read_utf(),
|
||||
"is_stream": body_reader.read_bool(),
|
||||
"uri": body_reader.read_optional_utf(),
|
||||
"thumbnail": None if version <= 2 else body_reader.read_optional_utf(),
|
||||
"thumbnail": None if version != 0 else body_reader.read_optional_utf(),
|
||||
"sourceName": body_reader.read_utf(),
|
||||
"position": body_reader.read_long()
|
||||
}
|
||||
@@ -189,7 +189,7 @@ class TrackEncoder:
|
||||
def encode(self, stream: MessageOutput, track) -> None:
|
||||
body_writer = stream.start()
|
||||
|
||||
body_writer.write_byte(3)
|
||||
body_writer.write_byte(0)
|
||||
body_writer.write_utf(track.title)
|
||||
body_writer.write_utf(track.author)
|
||||
body_writer.write_long(track.length)
|
||||
|
||||
@@ -20,9 +20,10 @@ class IPCClient:
|
||||
|
||||
async def connect_and_reconnect(self):
|
||||
while True:
|
||||
await self.connect()
|
||||
print("Reconnect in next 10s!")
|
||||
await asyncio.sleep(10)
|
||||
if not self.is_connected:
|
||||
await self.connect()
|
||||
print("Reconnect in next 10s!")
|
||||
await asyncio.sleep(10)
|
||||
|
||||
async def connect(self):
|
||||
try:
|
||||
|
||||
@@ -20,10 +20,8 @@ def missingPermission(user_id:int):
|
||||
def error_msg(msg: str, *, user_id: int = None, guild_id: int = None, level: str = "info"):
|
||||
payload = {"op": "errorMsg", "level": level, "msg": msg}
|
||||
if user_id:
|
||||
payload["user_id"]: user_id
|
||||
payload["user_id"] = user_id
|
||||
if guild_id:
|
||||
payload["guild_id"]: guild_id
|
||||
payload["guild_id"] = guild_id
|
||||
|
||||
return payload
|
||||
|
||||
Reference in New Issue
Block a user