File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -58,7 +58,7 @@ the many subclasses offered in *discord-py-slash-command*.
58
58
from discord_slash.utils import manage_commands # Allows us to manage the command settings.
59
59
60
60
client = discord.Client(intents = discord.Intents.all())
61
- slash = SlashCommand(client, auto_register = True )
61
+ slash = SlashCommand(client, sync_commands = True )
62
62
63
63
guild_ids = [789032594456576001 ]
64
64
@@ -78,13 +78,14 @@ the many subclasses offered in *discord-py-slash-command*.
78
78
guild_ids = guild_ids
79
79
)
80
80
async def _test (ctx , argone : str ):
81
- await ctx.send(content = f " You responded with { argone} . " )
81
+ await ctx.respond()
82
+ await ctx.send(f " You responded with { argone} . " )
82
83
83
84
client.run(" your_bot_token_here" )
84
85
85
86
The main changes that you need to know about are with the lines calling the import
86
87
of ``manage_commands ``, as well as the ``options = [] ... `` code within the ``@slash.slash() ``
87
- context coroutine. This will now create a new option called "argOne " when shown for
88
+ context coroutine. This will now create a new option called "argone " when shown for
88
89
the slash command.
89
90
90
91
.. _quickstart : https://discord-py-slash-command.readthedocs.io/en/latest/quickstart.html
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ For this example, ``main.py`` will be used.
28
28
from discord_slash import SlashCommand # Importing the newly installed library.
29
29
30
30
client = discord.Client(intents = discord.Intents.all())
31
- slash = SlashCommand(client, auto_register = True ) # Declares slash commands through the client.
31
+ slash = SlashCommand(client, sync_commands = True ) # Declares slash commands through the client.
32
32
33
33
@client.event
34
34
async def on_ready ():
@@ -47,7 +47,7 @@ We can do so by adding this code shown here:
47
47
from discord_slash import SlashCommand # Importing the newly installed library.
48
48
49
49
client = discord.Client(intents = discord.Intents.all())
50
- slash = SlashCommand(client, auto_register = True ) # Declares slash commands through the client.
50
+ slash = SlashCommand(client, sync_commands = True ) # Declares slash commands through the client.
51
51
52
52
guild_ids = [789032594456576001 ] # Put your server ID in this array.
53
53
@@ -57,7 +57,8 @@ We can do so by adding this code shown here:
57
57
58
58
@slash.slash (name = " ping" , guild_ids = guild_ids)
59
59
async def _ping (ctx ): # Defines a new "context" (ctx) command called "ping."
60
- await ctx.send(content = f " Pong! ( { client.latency* 1000 } ms) " )
60
+ await ctx.respond()
61
+ await ctx.send(f " Pong! ( { client.latency* 1000 } ms) " )
61
62
62
63
client.run(" your_bot_token_here" )
63
64
You can’t perform that action at this time.
0 commit comments