aboutsummaryrefslogtreecommitdiffstats
path: root/pydis_site/apps/content/resources
diff options
context:
space:
mode:
authorGravatar Ash <[email protected]>2022-07-01 16:00:51 +0100
committerGravatar GitHub <[email protected]>2022-07-01 16:00:51 +0100
commit823a6d2e3ebe7667b6bb2e2cc49635b4684cefcc (patch)
tree373f22cc05238afd7c3369312eef37a1828cb17f /pydis_site/apps/content/resources
parentUpdate pydis_site/apps/content/resources/guides/python-guides/discord-app-com... (diff)
Update pydis_site/apps/content/resources/guides/python-guides/discord-app-commands.md
A good point indeed Co-authored-by: Robin <[email protected]>
Diffstat (limited to 'pydis_site/apps/content/resources')
-rw-r--r--pydis_site/apps/content/resources/guides/python-guides/discord-app-commands.md2
1 files changed, 1 insertions, 1 deletions
diff --git a/pydis_site/apps/content/resources/guides/python-guides/discord-app-commands.md b/pydis_site/apps/content/resources/guides/python-guides/discord-app-commands.md
index 1a6e2453..d5f204b0 100644
--- a/pydis_site/apps/content/resources/guides/python-guides/discord-app-commands.md
+++ b/pydis_site/apps/content/resources/guides/python-guides/discord-app-commands.md
@@ -111,7 +111,7 @@ __**EXPLANATION**__
- `import discord` imports the **discord.py** package.
- `class SlashClient(discord.Client)` is a class subclassing **Client**. Though there is no particular reason except readability to subclass the **Client** class, using the `Client.setup_hook = my_func` is equally valid.
- Next up `super().__init__(...)` runs the `__init__` function of the **Client** class, this is equivalent to `discord.Client(...)`. Then, `self.tree = discord.app_commands.CommandTree(self)` creates a CommandTree which acts as the container for slash commands, and binds it to the `discord.Client` subclass instance, so wherever you have access to it, you will also have access to the command tree.
-- Then in the `setup_hook`, `self.tree.copy_global_to(...)` adds the slash command to the guild of which the ID is provided as a `discord.Object` object. Further up, `self.tree.sync()` updates the API with any changes to the slash commands.
+- Then in the `setup_hook`, `self.tree.copy_global_to(...)` adds the slash command to the guild of which the ID is provided as a `discord.Object` object. Further up, `self.tree.sync()` updates the API with any changes to the slash commands. **Without calling this method, your changes will only be saved locally and will NOT show up on Discord!**
- Finishing up with the **Client** subclass, we create an instance of the subclassed Client class which here has been named as `SlashClient` with `client = SlashClient()`.
- Then using the `command` method of the `CommandTree` we decorate a function with it as `client.tree` is an instance of `CommandTree` for the current application. The command function takes a default argument as said, which acts as the interaction that took place. Catching up is `await interaction.response.send_message("pong")` which sends back a message to the slash command invoker.
- And the classic old `client.run("token")` is used to connect the client to the discord gateway.