无法识别事件消息

event message is not recognized

我正在尝试制作一个不和谐的机器人,我想添加处理诸如 ?help、?creator 等事件的功能。如果命令在 ? 之后,我想发送一条消息。不被认可。这是我的代码:

import os
import discord

client = discord.Client()
unrecogcommand = "I don't recognize this command do **?help** for the list of the available 
commands :3"

@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('?'):
    if message.content.startswith('?ownerfavOP'):
      await message.channel.send("The server Owner really love Kaikai Kitan 
https://www.youtube.com/watch?v=i1P-9IspBus :3")

    if message.content.startswith('?creator'):
      await message.channel.send("PashPash#7668 is the username of the creator and have a yt 
channel https://www.youtube.com/channel/UCxJXY07JAsmJBaYf67KKk7Q")

    if message.content.startswith('?help'):
      await message.channel.send("Command available ```?help``` ```ownerfavOP```")

client.run(os.getenv('TOKEN'))

我会这样接近你的command

@client.event
async def on_message(message):
    if message.author != client.user:
        if message.content.startswith('?'):
            if message.content.startswith('?ownerfavOP'):
                # do something
            elif message.content.startswith('?creator'):
                # do something
            elif message.content.startswith('?help'):
                # do something
            else:
                print("Couldn't found that command.")

注意 我删除了 return 语句,因为如果 message author 等于 [=14=,命令将自动 return ].

我希望这对你有帮助,sheers!