Skip to content

Commit af4d6ca

Browse files
Update README.rst
1 parent 2414b04 commit af4d6ca

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

README.rst

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -72,22 +72,20 @@ Quick Example
7272
7373
import discord
7474
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")
8987
90-
Bot Example
88+
Normal Commands Example
9189
~~~~~~~~~~~~~
9290

9391
.. code:: py

0 commit comments

Comments
 (0)