Trying to add localization

This commit is contained in:
bacon
2024-03-09 17:04:18 +03:00
parent 75869de1cd
commit 3bd30239ae
4 changed files with 49 additions and 32 deletions

View File

@@ -16,18 +16,21 @@ class General(commands.Cog):
@commands.slash_command(
name="info",
description="Read list of tracks for user",
options=[
Option("user", "Specify any user", OptionType.user),
]
)
async def info(self, inter: disnake.ApplicationCommandInteraction, user=None):
audio = None
"""
Shows user info {{SLASH_INFO}}
Parameters
----------
:param inter:
:param user:
:return:
"""
user = user or inter.author
_user = DBReader(inter.guild.id)
for r in _user:
if r.userid == user.id:
audio = r.defaulttracks
rolelist = [r.mention for r in user.roles if r != inter.guild.default_role]
if rolelist:
@@ -35,11 +38,6 @@ class General(commands.Cog):
else:
roles = "Not added any role"
if audio:
audios = "" + "\n".join(sorted(audio.split(", ")))
else:
audios = "Not selected audio"
emb = disnake.Embed(
title="General information",
description=f"General information on server about {user}",
@@ -50,9 +48,8 @@ class General(commands.Cog):
value=f"Username: {user}\n"
f"Nickname: {user.nick}\n"
f"Joined at: {user.joined_at.strftime('%A, %B %d %Y @ %H:%M:%S')}", inline=False)
emb.add_field(name="Default audio list", value=f"{audios}")
emb.add_field(name="Roles list", value=f"{roles}")
emb.set_footer(text="Information requested by: {}".format(inter.author.display_name))
emb.set_footer(text=f"Information requested by: {inter.author.display_name}")
await inter.response.send_message(embed=emb, ephemeral=True)