File tree Expand file tree Collapse file tree 2 files changed +9
-10
lines changed Expand file tree Collapse file tree 2 files changed +9
-10
lines changed Original file line number Diff line number Diff line change 2
2
3
3
bot = discord .Bot ()
4
4
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
7
7
8
+ # With discord.Bot you can use @bot.command as an alias
9
+ # of @bot.slash_command but this is overriden by commands.Bot
8
10
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
10
13
async def hello (ctx ):
11
14
"""Say hello to the bot""" # the command description can be supplied as the docstring
12
15
await ctx .send (f"Hello { ctx .author } !" )
13
16
14
17
15
- @bot .command (
18
+ @bot .slash_command (
16
19
name = "hi"
17
20
) # Not passing in guild_ids creates a global slash command (might take an hour to register)
18
21
async def global_command (ctx , num : int ): # Takes one integer parameter
19
22
await ctx .send (f"This is a global command, { num } !" )
20
23
21
24
22
- @bot .command (guild_ids = [...])
25
+ @bot .slash_command (guild_ids = [...])
23
26
async def joined (
24
27
ctx , member : discord .Member = None
25
28
): # Passing a default value makes the argument optional
Original file line number Diff line number Diff line change 3
3
4
4
bot = discord .Bot ()
5
5
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 = [...])
11
7
async def hello (
12
8
ctx ,
13
9
name : Option (str , "Enter your name" ),
You can’t perform that action at this time.
0 commit comments