Python Discord Bot,如果 client.event 在脚本中,client.command 将停止工作

时间:2021-07-01 20:28:58

标签: python discord.py

我在 python 中创建了一个 discord bot,但每次我将它添加到我的脚本中时,命令都会停止工作:

@client.event
async def on_message(message):
  message=message.content
  print(message)

有人知道怎么解决吗? 提前致谢!!!!

1 个答案:

答案 0 :(得分:0)

将此行添加到您的代码中:

await bot.process_commands(message)

例如:

@bot.event
async def on_message(message):
    # do some extra stuff here

    await bot.process_commands(message)

不要在“齿轮”中使用。