Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/38.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何通过channelUpdate事件检查谁在Discord上编辑了频道_Javascript_Node.js_Bots_Discord_Discord.js - Fatal编程技术网

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”