不和Bot不可用的公会问题



我开始为我朋友的服务器创建我自己的Discord bot,我一直遇到同样的问题。

我写了一个简单的东西来实现我和bot之间的第一次交互:

client.on("messageCreate", message => {
console.log(message.content);
});

这应该在控制台上写入bot连接的不和谐服务器上发送的任何消息的内容(它只连接到我的测试服务器)

我不明白为什么这不起作用,所以我开始寻找它,并使用了"debug"事件。

当运行node index.js时,控制台告诉我:

Booting up...
[WS => Manager] Fetched Gateway Information
URL: wss://gateway.discord.gg
Recommended Shards: 1
[WS => Manager] Session Limit Information
Total: 1000
Remaining: 981
[WS => Manager] Spawning shards: 0
[WS => Shard 0] [CONNECT]
Gateway    : wss://gateway.discord.gg/
Version    : 9
Encoding   : json
Compression: none
[WS => Shard 0] Setting a HELLO timeout for 20s.
[WS => Shard 0] [CONNECTED] Took 172ms
[WS => Shard 0] Clearing the HELLO timeout.
[WS => Shard 0] Setting a heartbeat interval for 41250ms.
[WS => Shard 0] [IDENTIFY] Shard 0/1 with intents: 8
[WS => Shard 0] [READY] Session f3fcd33aad118dc188b7b63c3eec3eed.
[WS => Shard 0] [ReadyHeartbeat] Sending a heartbeat.
[WS => Shard 0] Shard will not receive any more guild packets.
Unavailable guild count: 1
Booted !
[WS => Shard 0] Heartbeat acknowledged, latency of 112ms.
[WS => Shard 0] [HeartbeatTimer] Sending a heartbeat.
[WS => Shard 0] Heartbeat acknowledged, latency of 120ms.
[WS => Shard 0] [HeartbeatTimer] Sending a heartbeat.

然后它继续发送心跳并确认它,直到我停止它。

告诉我有什么不对劲的是:

碎片将不再收到任何公会包

"不可使用的公会数量:1">

这是我的整个index.js(只有我的令牌在config.json中):

console.log("Booting up...");
const { Client, Intents } = require("discord.js"); 
const {spd} = require("./config.json");
const botIntents = 8;
const client = new Client({intents : botIntents});
client.login(spd);
client.once("ready", isBooted);
client.on("messageCreate", message => {
console.log(message.content);
});
client.on("debug", err => { 
console.log(err);
});
/////////
function isBooted() {
console.log(" Booted !");
}

系统信息:

Windows 10
NPM 8.0.0
Node v16.11.1
Discord.js 13.2.0

如果你需要进一步的信息来帮助你,告诉我。

似乎你使用的唯一意图是GUILD_EMOJIS_AND_STICKERS,我发现这个意图计算器。你应该显示每个意图,这样你就可以很容易地修改它:

const { Client, Intents } = require("discord.js")
const client = new Client({intents : [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES]});

相关内容

  • 没有找到相关文章