diff --git a/docs/Interactions/buttons.mdx b/docs/Interactions/Application-Commands/buttons.mdx similarity index 99% rename from docs/Interactions/buttons.mdx rename to docs/Interactions/Application-Commands/buttons.mdx index 18cd81ba..74405745 100644 --- a/docs/Interactions/buttons.mdx +++ b/docs/Interactions/Application-Commands/buttons.mdx @@ -18,7 +18,7 @@ import TabItem from "@theme/TabItem"; On May 26, 2021, Discord added a new interaction called buttons. Instead of reactions, bots could now send buttons and users could use them to interact with bots. This opened up a whole new world of -possibilities for bots. Soon after, developers made calculators, polls, and games like blackjack, Uno, +possibilities for bots. Soon after, developers made calculators, polls, and games like blackjack, Uno, and even Minecraft! Buttons provided a clear and easy to use interface for interacting with bots. So, let's see how you can add buttons to your bot! @@ -102,7 +102,7 @@ about making your button do amazing things, while Pycord handles the rest! Check out the [`discord.ButtonStyle`](https://docs.pycord.dev/en/master/api.html#discord.ButtonStyle) class for more information. -![Different Button Styles](../assets/interactions/button-styles.png) +![Different Button Styles](../../assets/interactions/button-styles.png) You can set a button's style by adding the `style` argument in the [`discord.ui.button`](https://docs.pycord.dev/en/master/api.html#discord.ui.button) decorator. diff --git a/docs/Interactions/context-menus.mdx b/docs/Interactions/Application-Commands/context-menus.mdx similarity index 100% rename from docs/Interactions/context-menus.mdx rename to docs/Interactions/Application-Commands/context-menus.mdx diff --git a/docs/Interactions/dropdowns.mdx b/docs/Interactions/Application-Commands/dropdowns.mdx similarity index 100% rename from docs/Interactions/dropdowns.mdx rename to docs/Interactions/Application-Commands/dropdowns.mdx diff --git a/docs/Interactions/modal-dialogs.mdx b/docs/Interactions/Application-Commands/modal-dialogs.mdx similarity index 100% rename from docs/Interactions/modal-dialogs.mdx rename to docs/Interactions/Application-Commands/modal-dialogs.mdx diff --git a/docs/Interactions/slash-commands.mdx b/docs/Interactions/Application-Commands/slash-commands.mdx similarity index 97% rename from docs/Interactions/slash-commands.mdx rename to docs/Interactions/Application-Commands/slash-commands.mdx index 12b1843f..626082ac 100644 --- a/docs/Interactions/slash-commands.mdx +++ b/docs/Interactions/Application-Commands/slash-commands.mdx @@ -103,7 +103,7 @@ bot.run("TOKEN") Here's what the registered subcommands will look like in the Slash Command Menu: -![Picture of the subcommands in the Slash Command Menu](../assets/interactions/groups-and-subcommands.jpg) +![Picture of the subcommands in the Slash Command Menu](../../assets/interactions/groups-and-subcommands.jpg) You'll notice that there's the name of the Slash Command Group and then the name of the subcommand separated by a space. @@ -218,8 +218,8 @@ bot = discord.Bot() @bot.command() # this explicitly tells pycord what types the options are instead of it figuring it out by itself async def join( - ctx, - first: discord.Option(discord.SlashCommandOptionType.string), + ctx, + first: discord.Option(discord.SlashCommandOptionType.string), second: discord.Option(discord.SlashCommandOptionType.string) ): joined = first + second diff --git a/docs/Interactions/localizations.mdx b/docs/Interactions/localizations.mdx new file mode 100644 index 00000000..fe4a23bb --- /dev/null +++ b/docs/Interactions/localizations.mdx @@ -0,0 +1,55 @@ +--- +title: Localizations +--- + +Localizations are a way to make your bot more accessible to your users. You can localize the command +name, the names of any arguments, and any text that is displayed to the user. + +## Syntax +```python +@commands.slash_command( + name="ping", + name_localizations={ + "en-GB": "British_Ping" + }, + description="Ping the bot", + description_localizations={ + "en-GB": "British ping the bot" + }, + options=[ + Option( + name="Example", + name_localizations={ + "en-GB": "British Example" + }, + description="Example option that does nothing", + description_localizations={ + "en-GB": "British example option that does nothing" + } + ) + ] +) +async def ping(ctx, example): + responses = {"en-US": "Pong!", + "en-GB": "British Pong!"} + await ctx.respond(responses.get(ctx.interaction.locale, responses['en-US'])) + +@commands.slash_command( + name="ping2", + name_localizations={ + "en-GB": "British_Ping" + }, + description="Ping the bot", + description_localizations={ + "en-GB": "British ping the bot" + } +) +async def ping2(ctx, example: Option(str, "example", name_localizations={"en-GB": "British Example"}, description="Example option that does nothing", description_localizations={"en-GB": "British example option that does nothing"})): + responses = {"en-US": "Pong2!", + "en-GB": "British Pong2!"} + await ctx.respond(responses.get(ctx.interaction.locale, responses['en-US'])) + +``` + + +- [`Locales`](https://discord.com/developers/docs/reference#locales) - List of valid locales recognized by Discord \ No newline at end of file diff --git a/sidebars.js b/sidebars.js index 2a2c042f..c34e3547 100644 --- a/sidebars.js +++ b/sidebars.js @@ -31,11 +31,18 @@ const sidebars = { label: "Interactions", link: { type: "doc", id: "Interactions/index" }, items: [ - "Interactions/buttons", - "Interactions/dropdowns", - "Interactions/slash-commands", - "Interactions/context-menus", - "Interactions/modal-dialogs" + { + type: "category", + label: "Application Commands", + items: [ + "Interactions/Application-Commands/slash-commands", + "Interactions/Application-Commands/context-menus", + "Interactions/Application-Commands/buttons", + "Interactions/Application-Commands/dropdowns", + "Interactions/Application-Commands/modal-dialogs" + ] + }, + "Interactions/localizations" ], }, {