forked from Rapptz/discord.py
-
Notifications
You must be signed in to change notification settings - Fork 208
Open
Labels
unconfirmed bugUnconfirmed bugUnconfirmed bug
Description
Summary
The quickstart code from https://discordpy-self.readthedocs.io/en/latest/quickstart.html is wrong.
Reproduction Steps
As you can see, the quickstart code currently ignores every message that is not from the "bot user", instead of ignoring messages from the "bot user".
Code
import discord
client = discord.Client()
@client.event
async def on_ready():
print(f'We have logged in as {client.user}')
@client.event
async def on_message(message):
if message.author != client.user:
return
if message.content.startswith('$hello'):
await message.channel.send('Hello!')
client.run('your token here')
Expected Results
Anyone saying "$hello" should be greeted with "Hello!"
Actual Results
Only the current bot user can send "$hello" and be greeted (by itself).
System Information
It's inside the docs.
Checklist
- I have confirmed I am using unmodified discord.py-self and not the upstream discord.py.
- I am using a user token (and it isn't visible in the code).
- I have searched the open issues for duplicates.
- I have searched closed issues for resolved duplicates.
- I have confirmed the development version doesn't resolve the issue.
- I have shared the entire traceback.
Additional Information
This can be fixed by replacing "!=" by "==" in on_message.
Metadata
Metadata
Assignees
Labels
unconfirmed bugUnconfirmed bugUnconfirmed bug