Skip to content

Instantly share code, notes, and snippets.

@Wolfhound905
Created March 25, 2022 04:36
Show Gist options
  • Save Wolfhound905/19b97a1f91f50fe4431ebc7a2bed06ac to your computer and use it in GitHub Desktop.
Save Wolfhound905/19b97a1f91f50fe4431ebc7a2bed06ac to your computer and use it in GitHub Desktop.
Example usage of command localization
import dis_snek as dis
bot = dis.Snake(debug_scope=12345, sync_interactions=True, delete_unused_application_cmds=True)
description_locales = {
"en-GB": "an english description",
"da": "en dansk beskrivelse",
"de": "eine deutsche Beschreibung",
"es-ES": "una descripción en español",
"fr": "une description en français",
"hr": "hrvatski opis",
"it": "una descrizione in italiano",
"lt": "lietuviškas aprašymas",
"hu": "magyar leírás",
"nl": "een Nederlandse beschrijving",
"no": "en norsk beskrivelse",
"pl": "polski opis",
"pt-BR": "uma descrição em português",
"ro": "o descriere în română",
"fi": "suomen kuvaus",
"sv-SE": "en svensk beskrivning",
"vi": "một mô tả tiếng việt",
"tr": "Türkçe açıklama",
"cs": "český popis",
"el": "ελληνική περιγραφή",
"bg": "български опис",
"ru": "русский описание",
"uk": "український опис",
"hi": "हिन्दी वर्णन",
"th": "ไทย คำอธิบาย",
"zh-CN": "中文描述",
"ja": "日本語の説明",
"zh-TW": "繁體中文說明",
"ko": "한국어 설명",
}
name_locales = {
"en-GB": "british",
"da": "dansk",
"de": "deutsch",
"es-ES": "español",
"fr": "français",
"hr": "hrvatski",
"it": "italiano",
"lt": "lietuviškas",
"hu": "magyar",
"nl": "nederlands",
"no": "norsk",
"pl": "polski",
"pt-BR": "português",
"ro": "română",
"fi": "suomi",
"sv-SE": "svenska",
"vi": "tiếng việt",
"tr": "türkçe",
"cs": "čeština",
"el": "ελληνικά",
"bg": "български",
"ru": "русский",
"uk": "український",
"hi": "हिन्दी",
"th": "ไทย",
"zh-CN": "中文",
"ja": "日本語",
"zh-TW": "繁體中文",
"ko": "한국어",
}
@dis.slash_command("langauage", "an english description")
@dis.slash_name_locales(name_locales)
@dis.slash_description_locales(description_locales)
async def test(ctx: dis.InteractionContext):
await ctx.send("test", ephemeral=True)
print(bot.commands)
bot.start("")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment