File tree Expand file tree Collapse file tree 1 file changed +13
-15
lines changed Expand file tree Collapse file tree 1 file changed +13
-15
lines changed Original file line number Diff line number Diff line change @@ -72,22 +72,20 @@ Quick Example
72
72
73
73
import discord
74
74
75
- class MyClient (discord .Client ):
76
- async def on_ready (self ):
77
- print (" Logged on as" , self .user)
78
-
79
- async def on_message (self , message ):
80
- # don't respond to ourselves
81
- if message.author == self .user:
82
- return
83
-
84
- if message.content == " ping" :
85
- await message.channel.send(" pong" )
86
-
87
- client = MyClient()
88
- client.run(" token" )
75
+ bot = discord.Bot()
76
+
77
+ @bot.slash_command ()
78
+ async def hello (ctx , name : str = None ):
79
+ name = name or ctx.author.name
80
+ await ctx.send(f " Hello { name} ! " )
81
+
82
+ @bot.user_command (name = " Say Hello" )
83
+ async def hi (ctx , user ):
84
+ await ctx.send(f " { ctx.author.mention} says hello to { user.name} ! " )
85
+
86
+ bot.run(" token" )
89
87
90
- Bot Example
88
+ Normal Commands Example
91
89
~~~~~~~~~~~~~
92
90
93
91
.. code :: py
You can’t perform that action at this time.
0 commit comments