Utilizing the ChannelUpdate event in Discord.js for my bot, I am able to log the previous information of a channel when it is updated, including details such as name, ID, type, creator, etc. However, I encountered an issue where using channel.client.user.username to retrieve the channel's creator ends up displaying the bot's username instead. How can this be resolved? See the code snippet below for reference.
const Discord = require('discord.js');
const bot = new Discord.Client();
bot.on('ready', () => {
console.log(`${bot.user.username} is now online!`)
});
// Channel Update Event ---
bot.on('channelUpdate', oldChannel => {
console.log(`${oldChannel.name} has been updated in ${oldChannel.guild.name}, here are the channel details before and after the update:`);
console.log(`Channel Name Before: ${oldChannel.name}`);
console.log(`Channel ID Before: ${oldChannel.id}`);
console.log(`Channel Creator Before: ${oldChannel.client.user.username}`);
console.log(`Channel Type Before: ${oldChannel.type}`);
console.log(`Channel Creation Date Before: ${oldChannel.createdAt}`);
console.log(`Channel Name Now: ${channel.name}`);
console.log(`Channel ID Now: ${channel.id}`);
console.log(`Channel Creator Now: ${guild.channel.client.user}`);
console.log(`Channel Type Now: ${channel.type}`);
console.log(`Channel Creation Date Now: ${channel.createdAt}`);
});