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 11from 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.
33
44class Example (commands .Cog ):
55 def __init__ (self , bot ):
66 self .bot = bot
77
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 ):
1010 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!" )
1116
1217def setup (bot ):
1318 bot .add_cog (Example (bot ))
You can’t perform that action at this time.
0 commit comments