From 89fe6378d52121204c9dbbd4617ea3998faed2c7 Mon Sep 17 00:00:00 2001 From: Wolfdragon24 Date: Sat, 28 Oct 2023 14:49:02 +1100 Subject: [PATCH 1/2] Accounting for non-channel returns associated to snowflakes --- commands/rolesPermOverride.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/commands/rolesPermOverride.js b/commands/rolesPermOverride.js index 6e655b3a..8747167a 100644 --- a/commands/rolesPermOverride.js +++ b/commands/rolesPermOverride.js @@ -24,6 +24,9 @@ const in_overwrites = (overwrites, id) => async function editChannels(interaction, channels) { for (const data of channels) { const channel = data[1]; + + if (!channel) continue; + const is_valid = is_valid_course_name(channel.name); if (!is_valid || channel.type !== "GUILD_TEXT") continue; @@ -98,6 +101,9 @@ async function allFixed(interaction, channels) { const unfixed = []; for (const data of channels) { const channel = data[1]; + + if (!channel) continue; + const fixed = await isFixed(interaction, channel); if (!fixed) unfixed.push(channel.name); From 36000a92759232330b638e30e4dbd2bdecc045df Mon Sep 17 00:00:00 2001 From: Wolfdragon24 Date: Tue, 31 Oct 2023 10:28:18 +1100 Subject: [PATCH 2/2] Utilise cache directly as fetch falls back to a cache call anyway --- commands/rolesPermOverride.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commands/rolesPermOverride.js b/commands/rolesPermOverride.js index 8747167a..f859cff2 100644 --- a/commands/rolesPermOverride.js +++ b/commands/rolesPermOverride.js @@ -149,7 +149,7 @@ module.exports = { if (!interaction.options.getBoolean("singlechannel")) { // Get all channels and run specified function - const channels = await interaction.guild.channels.fetch(); + const channels = interaction.guild.channels.cache; if (!interaction.options.getBoolean("check")) { await editChannels(interaction, channels);