且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

检查用户是否在特定的公会中 discord.js

更新时间:2023-11-30 12:12:28

很有可能...

我们可以使用 Collector#filter 方法,因为我们想要过滤 bot 和作者所在的公会.

We can use the Collector#filter method for this since we would want to filter the guild(s) the bot and the author is.

const mutualGuilds = client.guilds.cache.filter((guild) => {
   return guild.members.cache.has(message.author.id);
});

    // This will log the mutual guild(s) the bot and the author is in, of course you can change it however you'd like.
console.log(mutualGuilds);

就这么简单.