From a39f429c1714b556004e0c5e504215f540f5ebba Mon Sep 17 00:00:00 2001 From: Abheek Dhawan Date: Wed, 31 Mar 2021 14:59:52 -0500 Subject: [PATCH] Test fix null errors --- index.js | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/index.js b/index.js index 1d597c8..2d75fc9 100644 --- a/index.js +++ b/index.js @@ -46,13 +46,21 @@ client.on('messageUpdate', (originalMessage, editedMessage) => { client.on('channelCreate', channel => { if (channel.guild.id = "826506878976000030") { + const channelName = channel.name; + const channelID = channel.id; + let channelCategory; + if (channel.parent.name) { + channelCategory = channel.parent.name; + } else { + channelCategory = "None"; + } const channelCreateEmbed = new Discord.MessageEmbed() - .setTitle("Channel Created #️⃣") - .addField("Name", channel.name) - .addField("Category", channel.parent.name) - .setFooter("ID: " + channel.id) + .setTitle("#️⃣Channel Created") + .addField("Name", channelName) + .addField("Category", channelCategory) + .setFooter("ID: " + channelID) .setTimestamp() - .setColor('006699'); + .setColor('00aaff'); client.guilds.cache.get("826506878976000030").channels.cache.get("826876551756513314").send(channelCreateEmbed).catch(console.error); } });