From 11c904a25fa4cbe7ee0a3fbe724d76a9a3768dc8 Mon Sep 17 00:00:00 2001 From: Taken Date: Wed, 22 Nov 2023 14:01:06 +0100 Subject: [PATCH] Updated code base --- events/server/ready/sendOnlineMessage.js | 26 +++++++++---------- events/server/voiceStateUpdate/vcJoinLeave.js | 12 +++++++-- 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/events/server/ready/sendOnlineMessage.js b/events/server/ready/sendOnlineMessage.js index 7bca2ef..5ca990d 100644 --- a/events/server/ready/sendOnlineMessage.js +++ b/events/server/ready/sendOnlineMessage.js @@ -7,21 +7,21 @@ module.exports = { event: 'ready', execute(client) { - if (process.env.NODE_ENV !== 'dev') { - const channel = client.channels.cache.get(onlineLogChannel); - const embedColor = Number(color.replace('#', '0x')) + if (process.env.NODE_ENV === 'dev') return - if (!channel) { - console.log(`[ERROR] Could not find channel used for online message.`); - return; - } + const channel = client.channels.cache.get(onlineLogChannel); + const embedColor = Number(color.replace('#', '0x')) - channel.send({ - embeds: [{ - description: `Bot is online!`, - color: embedColor - }] - }); + if (!channel) { + console.log(`[ERROR] Could not find channel used for online message.`); + return; } + + channel.send({ + embeds: [{ + description: `Bot is online!`, + color: embedColor + }] + }); } } diff --git a/events/server/voiceStateUpdate/vcJoinLeave.js b/events/server/voiceStateUpdate/vcJoinLeave.js index 3599888..07648c1 100644 --- a/events/server/voiceStateUpdate/vcJoinLeave.js +++ b/events/server/voiceStateUpdate/vcJoinLeave.js @@ -14,11 +14,19 @@ module.exports = { execute(oldState, newState) { + if (process.env.NODE_ENV === 'dev') return + + const channel = guild.channels.cache.get(botLogChannel) + const embedColor = Number(color.replace('#', '0x')) + + if (!channel) { + console.log(`[ERROR] Could not find channel used for voice channel join/leave logging.`) + return + } + const oldChannel = oldState.channel const newChannel = newState.channel const guild = oldState.guild - const channel = guild.channels.cache.get(botLogChannel) - const embedColor = Number(color.replace('#', '0x')) if (oldChannel === null && newChannel !== null) {