获取邀请Bot的成员



我正在尝试使用guildCreate事件获取邀请机器人的人的GuildMember对象。

const fetchedLogs = await message.guild.fetchAuditLogs({
limit: 1,
type: ''
})

不确定我是否走在正确的道路上,但是,如果我是,我应该为type传递什么参数?

以下是我用来查找邀请机器人的用户的代码,这对我来说已经足够好了

bot.on('guildCreate', (guild) => {
console.log(`event guildCreate: ${guild.name} ${guild.id}`);
guild.fetchAuditLogs({ limit: 1, type: 28 }) // type 28 is "add bot"
.then(audit => {
let userID = audit.entries.first().executor.id;
// do something here
})
.catch(console.error);
});

最新更新