Hello, I am new here, getting into the world of coding.
I tried following the basic normal example of:
import discord
client = discord.Client()
@client.event
async def on_ready():
print('We have logged in as {0.user}'.format(client))
@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')
But I get an error in the .author, .content, .channel and .user
For some reason it lightens in red, not sure what is going on. May someone be able to give me a hand?
I am using Atom IDE (if the info is useful).
Kind regards,
Ezequiel
Did you install the discord.py library with pip? If so, the problem may be that the IDE doesn’t recognize the library, which may not present an error.
However, without your actual token it won’t work.
In that case your code is OK. The lightens in red part doesn’t actually means it’s an error, it could mean that the IDE doesn’t recognize the variable names (or object properties).
Try it out and see if it works (replacing your token here with your actual token).