首页 > 解决方案 > 如果 client.event 在脚本中,Python Discord Bot,client.command 将停止工作

问题描述

我在 python 中制作了一个不和谐的机器人,但每次我将它添加到我的脚本时,命令都会停止工作:

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

有人知道,如何解决?提前致谢!!!!

标签: pythondiscord.py

解决方案


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

await bot.process_commands(message)

例如:

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

    await bot.process_commands(message)

不要在“齿轮”中使用。


推荐阅读