Audit Log Channel Update Event
With the code below, when I update a channel's parent,
auditLogauditLog is undefined. Why?module.exports = {
name: Events.ChannelUpdate,
on: true,
async execute(oldChannel, newChannel, client){
const guild = client.guilds.cache.get(newChannel.guildId)
if (!guild) return;
if (newChannel.type == ChannelType.DM || newChannel.type == ChannelType.GroupDM) return;
const auditLogs = await guild.fetchAuditLogs({
limit: 1,
type: AuditLogEvent.ChannelUpdate
});
--> const auditLog = auditLogs.entries.first()module.exports = {
name: Events.ChannelUpdate,
on: true,
async execute(oldChannel, newChannel, client){
const guild = client.guilds.cache.get(newChannel.guildId)
if (!guild) return;
if (newChannel.type == ChannelType.DM || newChannel.type == ChannelType.GroupDM) return;
const auditLogs = await guild.fetchAuditLogs({
limit: 1,
type: AuditLogEvent.ChannelUpdate
});
--> const auditLog = auditLogs.entries.first()