interactions/localizations.py
An example on how to set up localized application commands.
Use the buttons below to view on GitHub or in Discord.
1 messages · Page 1 of 1 (latest)
An example on how to set up localized application commands.
You create the json file with the translations and proper keys. You load the file BEFORE any @bot.whatever_command and and BEFORE any cog loading.
Then your docstrings should have the keys so disnke can tell discord how to translate.
I don't know how the example could be any clearer.
Though, it should be updated, tbh. Use docstrings rather than OptionChoice
https://docs.disnake.dev/en/stable/ext/commands/slash_commands.html#localizations
@bot.slash_command()
async def add_5(inter: disnake.ApplicationCommandInteraction, num: int):
"""
Adds 5 to a number. {{ADD_NUM}}
Parameters
----------
num: Some number {{ COOL_NUMBER }}
"""
await inter.response.send_message(f"{num} + 5 = {num + 5}")