You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

启动Discord Bot遇Privileged message content intent缺失警告求助

解决Discord Bot的"Privileged message content intent is missing"警告

这个警告是因为Discord的**消息内容意图(Message Content Intent)**属于特权网关意图,你的Bot当前既没有在代码中启用该意图,也没有在Discord开发者后台开启它,导致命令可能无法正常响应消息内容。

步骤1:修改代码启用消息内容意图

在你的intents配置中添加message_content = True,修改后的代码片段如下:

intents = discord.Intents.default()
intents.members = True
intents.typing = True
intents.presences = True
# 添加这行启用消息内容意图
intents.message_content = True

client = commands.Bot(command_prefix = "?", intents=intents)

步骤2:在Discord开发者后台开启特权意图

仅修改代码还不够,你需要在Discord开发者门户中手动开启该特权意图:

  • 打开Discord开发者门户,找到你的Bot应用
  • 切换到Bot页面
  • 滚动到Privileged Gateway Intents区域
  • 开启Message Content Intent选项
  • 保存更改

完成以上两步后,重新启动你的Bot,警告就会消失,命令也能正常处理消息内容了。

另外注意你的代码中重复导入了random模块,可以删除其中一个冗余的导入,优化代码结构。

内容的提问来源于stack exchange,提问作者Mayedl10

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.21 15:45:57