Ask coding questions

← Back to all posts
Getting a mystery error message
MariusSorensen

Error: TypeError 'Client' object is not callable (line 11)

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
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'))

Voters
MariusSorensen
Comments
hotnewtop
Saml2020

You frogot the .event for the on message!

change it to @client.event