Ask coding questions

← Back to all posts
don't respond to command
Armandsavrins (0)

import discord

client = discord.Client()

Hi, i made some easy bot for first time , it's online in my discord server what i made for training purposes, but bot still don't want to answer command ,.$hi, any ideas why? i'm just beginner so be easy on me :D
@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('$hi'):
  await message.channel.send('hello!')
Comments
hotnewtop
Armandsavrins (0)

Thank you I forgot to delete the post but yea I solve the problem with including one more time async def on message ,. but thank you so much for help

CodeMaster007 (108)

So you actually have to include some code I assume. You have to have a file with the extension of .py and you have to run some command. If you don't want the main.py file and your code is in the lock file, then you can add a .repl file and make your run command whatever you want it to be. Hope that helps! :)