Javascript 如何通过channelUpdate事件检查谁在Discord上编辑了频道
我正在创建Javascript 如何通过channelUpdate事件检查谁在Discord上编辑了频道,javascript,node.js,bots,discord,discord.js,Javascript,Node.js,Bots,Discord,Discord.js,我正在创建updateChannel事件,但是,当我浏览Discord.JS文档时,我似乎找不到或弄不清是谁编辑了频道;或者这可能吗?我将在此消息下方提供当前代码 Discord.JS:v12.2.0 client.on("channelUpdate", async(oldChannel, newChannel) => { if(oldChannel.type === "dm") return undefined; const embe
updateChannel
事件,但是,当我浏览Discord.JS文档时,我似乎找不到或弄不清是谁编辑了频道;或者这可能吗?我将在此消息下方提供当前代码
Discord.JS:v12.2.0
client.on("channelUpdate", async(oldChannel, newChannel) => {
if(oldChannel.type === "dm") return undefined;
const embed = new Discord.MessageEmbed()
.setAuthor("Channel Updated", oldChannel.guild.iconURL({ dynamic: true }))
oldChannel.send(embed)
});
是的,这是可能的,您需要:
oldChannel.guild.fetchAuditLogs({type:11,limit:1})//CHANNEL\u UPDATE
。然后((日志)=>{
embed.setDescription(logs.entries.first().executor);//从GuildAuditLogs及其执行器的集合中获取first。
发送(嵌入);
})
.catch(控制台错误);
是的,这是可能的,您需要:
oldChannel.guild.fetchAuditLogs({type:11,limit:1})//CHANNEL\u UPDATE
。然后((日志)=>{
embed.setDescription(logs.entries.first().executor);//从GuildAuditLogs及其执行器的集合中获取first。
发送(嵌入);
})
.catch(控制台错误);
我认为您需要使用公会审核日志进行审核that@Giuliopime也有人告诉我,要从审计日志中获取信息。然而,我并不完全确定如何做到这一点。我认为你需要使用公会审计日志来进行审计that@Giuliopime也有人告诉我,要从审计日志中获取信息。但是,我不完全确定该怎么做。谢谢,但是,我收到了一个错误:TypeError:无法读取未定义的属性“executor”
谢谢,但是,我收到了一个错误:TypeError:无法读取未定义的属性“executor”