File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change 1
1
from discord .ext import commands
2
- from discord .commands import slash_command
2
+ from discord .commands import slash_command # Importing the decorator that makes slash commands.
3
3
4
4
class Example (commands .Cog ):
5
5
def __init__ (self , bot ):
6
6
self .bot = bot
7
7
8
- @slash_command ()
9
- async def example (self , ctx ):
8
+ @slash_command (guild_ids = [...]) # Create a slash command for the supplied guilds.
9
+ async def hello (self , ctx ):
10
10
await ctx .respond ("Hi, this is a slash command from a cog!" )
11
+
12
+
13
+ @slash_command () # Not passing in guild_ids creates a global slash command (might take an hour to register).
14
+ async def hi (self , ctx ):
15
+ await ctx .respond (f"Hi, this is a global slash command from a cog!" )
11
16
12
17
def setup (bot ):
13
18
bot .add_cog (Example (bot ))
You can’t perform that action at this time.
0 commit comments