Skip to content

Commit 7613fe1

Browse files
authored
Clarification
There were a few grammatical errors and inconsistencies that I wanted to clear up here.
1 parent 1f6ce42 commit 7613fe1

File tree

1 file changed

+14
-20
lines changed

1 file changed

+14
-20
lines changed

docs/quickstart.rst

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Quickstart
22
==========
33

44
Before doing anything, it is highly recommended to read discord.py's quickstart.
5-
You can find it by clicking :ref:`this <discord:quickstart>`.
5+
You can find it by clicking :ref:`this here <discord:quickstart>`.
66

77
Firstly, we will begin by installing the python library extension for discord.py:
88

@@ -38,38 +38,32 @@ For this example, ``main.py`` will be used.
3838
3939
Let's give this a run. When you run this code, you'll see... nothing but ``Ready!``.
4040

41-
That's completely normal, because we haven't defined any slash commands yet.
42-
We can do so by adding this code shown here:
41+
That's completely normal. Why is that? Well, it's because we haven't defined any actual
42+
slash commands just yet. We can do that by adding this code shown here:
4343

4444
.. code-block:: python
4545
46-
import discord
47-
from discord_slash import SlashCommand # Importing the newly installed library.
48-
49-
client = discord.Client(intents=discord.Intents.all())
50-
slash = SlashCommand(client, sync_commands=True) # Declares slash commands through the client.
51-
46+
"""
47+
Make sure this code is added before the client.run() call!
48+
It also needs to be under on_ready, otherwise, this will not work.
49+
"""
50+
5251
guild_ids = [789032594456576001] # Put your server ID in this array.
5352
54-
@client.event
55-
async def on_ready():
56-
print("Ready!")
57-
5853
@slash.slash(name="ping", guild_ids=guild_ids)
5954
async def _ping(ctx): # Defines a new "context" (ctx) command called "ping."
6055
await ctx.respond()
6156
await ctx.send(f"Pong! ({client.latency*1000}ms)")
6257
63-
client.run("your_bot_token_here")
64-
65-
Let's explain some of the major code differences between the prior examples shown
66-
here to give a better understanding of what is going on:
58+
Let's compare some of the major code differences between the prior examples in order
59+
to explain what's going on here:
6760

6861
- ``guild_ids = [789032594456576001]``: This is for adding your command as a guild command.
6962

70-
Otherwise, you need to wait for an hour to wait until your command is added. This is due
71-
to the code recognizing the new slash command as a **global** command instead of what we
72-
originally want, a *guild* slash command.
63+
It is very important for us to make sure that we're declaring this cpart of the ``@slash.slash``
64+
decorator if we're wanting to declare a guild command and not a **global** one. The reason as for
65+
why this is needed is because the Discord Bot API can take up to 1 hour to register a global
66+
command that is called via. the code here when this key-word argument is not passed.
7367

7468
- ``@slash.slash(name="ping", ...`` ~ ``await ctx.send(...)``: This adds a new slash command.
7569

0 commit comments

Comments
 (0)