import discord
import os
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(os.getenv('TOKEN'))
This is my code. I was trying to follow the tutorial on making a Discord Bot but for some reason, it keeps giving me a syntax error for line 18. I am a beginner so I personally don’t know what is wrong.
This is the link to the tutorial I was watching. I was only at 20 minute mark.
FreeCodeCamp’s Discord Bot Tutorial