My code works, but the bot doesnt run

So theres no errors in my code, and it works find, but when I type the command !hello it supposed to say hi back, but it does nothing

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('hi im darkbot');
 
client.run(i put the token here but i dont want to send it here');

Hi Dark,

You haven’t shared any code for us to look at to help you :slight_smile:

sorry lol ok i did now

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

you put the second statement inside the first, and as it is after a return it will never be executed
I recommend looking up basic Python syntax as it’s pretty essential here

what does this mean and how do i fix it (im very new)
client = discord.client() this is what has the error

this is with python

You will need to give more context, one single statement is not enough to know what’s going wrong

I merged your two topics, please keep using a single topic for questions on the same project

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.