I'm kinda new to python and I'm trying to create a discord bot. this is my code:
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('califrag'))
when I run it it keeps saying SyntaxError: 'await' outside function. I have NO IDEA what's causing, or how to fix it. Please help!
I'm kinda new to python and I'm trying to create a discord bot. this is my code: import discord import os client = discord.Client()
when I run it it keeps saying SyntaxError: 'await' outside function. I have NO IDEA what's causing, or how to fix it. Please help!