试图为不和谐制作一个聊天机器人,但它不起作用

Tried to make a chat bot for discord but it doesn't work

我正在 python (discord.py) 开发一个 discord 机器人。 我试图为我的机器人发出聊天命令,但它没有回复,也没有错误。 我问了我的朋友,但他也不知道怎么做,也不知道它有什么问题。 我的目标是让机器人回复,例如,如果我说你好,它会回复你好 + 我提到。

这是我的代码:

async def chat(ctx):
    await ctx.send("Chat mode ON")
    hi = "hello", "hi", "hallo"
    hgh = "how are you doing", "how are you doing?", "hoe gaat het?","how are you"
    exit = "bye", "exit", "Bye","Exit"
    invite = "invite", "can i get your invite link?"
    
    
    msg = await  bot.wait_for("message" )

    if msg.content == hi:
        await ctx.send("Hello " + ctx.message.author.mention)
    if msg.content == hgh:
        await ctx.send("Im doing as long as my script is running, how are you? " + ctx.message.author.mention)
    if msg.content == exit:
        await ctx.send("Bye, hope to see you again soon " + ctx.message.author.mention)
    if msg.content == invite:
        await ctx.send("This is my invite link: https://discord.com/oauth2/authorize?client_id=858775426490957845&permissions=8&scope=bot " + ctx.message.author.mention)```



If you know what is wrong with it and how to fix it please let me know, it would mean a lot to me.

 

如果你想要一个聊天机器人,请使用 on_message(message),你创建了一个名为“chat”的命令。

@bot.event
async def on_message (message):
 

if "hi" in message.content.lower():
    await ctx.send("Hello " + ctx.message.author.mention)
elif "hgh" in message.content.lower():
    await ctx.send("Im doing as long as my script is running, how are you? " + ctx.message.author.mention)
elif "invite" in message.content.lower():

    await ctx.send("This is my invite link: https://discord.com/oauth2/authorize?client_id=858775426490957845&permissions=8&scope=bot " + ctx.message.author.mention)