Skip to content

Commit d119c0d

Browse files
Use slash_command in examples
1 parent 0df3128 commit d119c0d

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

examples/app_commands/slash_basic.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,27 @@
22

33
bot = discord.Bot()
44

5-
# If you use commands.Bot, @bot.slash_command should be used for
6-
# slash commands. You can use @bot.slash_command with discord.Bot aswell
5+
# Note: If you want you can use commands.Bot as well
6+
# Use discord.Bot if you don't want prefixed message commands
77

8+
# With discord.Bot you can use @bot.command as an alias
9+
# of @bot.slash_command but this is overriden by commands.Bot
810

9-
@bot.command(guild_ids=[...]) # create a slash command for the supplied guilds
11+
12+
@bot.slash_command(guild_ids=[...]) # create a slash command for the supplied guilds
1013
async def hello(ctx):
1114
"""Say hello to the bot""" # the command description can be supplied as the docstring
1215
await ctx.send(f"Hello {ctx.author}!")
1316

1417

15-
@bot.command(
18+
@bot.slash_command(
1619
name="hi"
1720
) # Not passing in guild_ids creates a global slash command (might take an hour to register)
1821
async def global_command(ctx, num: int): # Takes one integer parameter
1922
await ctx.send(f"This is a global command, {num}!")
2023

2124

22-
@bot.command(guild_ids=[...])
25+
@bot.slash_command(guild_ids=[...])
2326
async def joined(
2427
ctx, member: discord.Member = None
2528
): # Passing a default value makes the argument optional

examples/app_commands/slash_options.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@
33

44
bot = discord.Bot()
55

6-
# If you use commands.Bot, @bot.slash_command should be used for
7-
# slash commands. You can use @bot.slash_command with discord.Bot aswell
8-
9-
10-
@bot.command(guild_ids=[...])
6+
@bot.slash_command(guild_ids=[...])
117
async def hello(
128
ctx,
139
name: Option(str, "Enter your name"),

0 commit comments

Comments
 (0)