Fixed some bugs

This commit is contained in:
Choco
2024-08-30 15:25:37 +08:00
parent 1feaa6eea2
commit 5722d35c11
4 changed files with 13 additions and 9 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

View File

@@ -195,7 +195,7 @@ class Basic(commands.Cog):
else:
position = await player.add_track(tracks[0])
texts = await get_lang(interaction.guild.id, "live", "trackLoad_pos", "trackLoad")
await interaction.response.send_message((f"`{texts[0]}`" if tracks[0].is_stream else "") + (texts[1].format(tracks[0].title, tracks[0].uri, tracks[0].author, tracks[0].formatted_length, position) if position >= 1 and player.is_playing else texts[2].format(tracks[0].title, tracks[0].uri, tracks[0].author, tracks[0].formatted_length)), allowed_mentions=False)
await interaction.followup.send((f"`{texts[0]}`" if tracks[0].is_stream else "") + (texts[1].format(tracks[0].title, tracks[0].uri, tracks[0].author, tracks[0].formatted_length, position) if position >= 1 and player.is_playing else texts[2].format(tracks[0].title, tracks[0].uri, tracks[0].author, tracks[0].formatted_length)), allowed_mentions=False)
except voicelink.QueueFull as e:
await interaction.followup.send(e)

View File

@@ -78,11 +78,15 @@ def langs_setup() -> None:
return
def time(millis:int) -> str:
seconds=(millis/1000)%60
minutes=(millis/(1000*60))%60
hours=(millis/(1000*60*60))%24
if hours > 1:
def time(millis: int) -> str:
seconds = (millis // 1000) % 60
minutes = (millis // (1000 * 60)) % 60
hours = (millis // (1000 * 60 * 60)) % 24
days = millis // (1000 * 60 * 60 * 24)
if days > 0:
return "%d days, %02d:%02d:%02d" % (days, hours, minutes, seconds)
elif hours > 0:
return "%d:%02d:%02d" % (hours, minutes, seconds)
else:
return "%02d:%02d" % (minutes, seconds)

View File

@@ -619,11 +619,11 @@ async def getSettings(bot: commands.Bot, data: Dict) -> Dict:
guild = bot.get_guild(guild_id)
if not guild:
return error_msg("Vocard don't have access to required guild.", user_id=user_id, level="error")
return error_msg("Vocard don't have access to requested guild.", user_id=user_id, level="error")
member = guild.get_member(user_id)
if not member:
return error_msg("You are not in the required guild.", user_id=user_id, level="error")
return error_msg("You are not in the requested guild.", user_id=user_id, level="error")
if not member.guild_permissions.manage_guild:
return error_msg("You don't have permission to access the settings.", user_id=user_id, level='error')
@@ -768,7 +768,7 @@ async def process_methods(ipc_client, bot: commands.Bot, data: Dict) -> None:
return
player = await connect_channel(member, bot)
if player.channel.id != member.voice.channel.id:
if not player or player.channel.id != member.voice.channel.id:
return
env["player"] = player