Skip to content

Commit b9576b5

Browse files
authored
Course Command Fixing - Collection Null Value Error (#162)
* Accounting for non-channel returns associated to snowflakes * Utilise cache directly as fetch falls back to a cache call anyway
1 parent 4bac7ae commit b9576b5

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

commands/rolesPermOverride.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ const in_overwrites = (overwrites, id) =>
2424
async function editChannels(interaction, channels) {
2525
for (const data of channels) {
2626
const channel = data[1];
27+
28+
if (!channel) continue;
29+
2730
const is_valid = is_valid_course_name(channel.name);
2831

2932
if (!is_valid || channel.type !== "GUILD_TEXT") continue;
@@ -98,6 +101,9 @@ async function allFixed(interaction, channels) {
98101
const unfixed = [];
99102
for (const data of channels) {
100103
const channel = data[1];
104+
105+
if (!channel) continue;
106+
101107
const fixed = await isFixed(interaction, channel);
102108

103109
if (!fixed) unfixed.push(channel.name);
@@ -143,7 +149,7 @@ module.exports = {
143149

144150
if (!interaction.options.getBoolean("singlechannel")) {
145151
// Get all channels and run specified function
146-
const channels = await interaction.guild.channels.fetch();
152+
const channels = interaction.guild.channels.cache;
147153

148154
if (!interaction.options.getBoolean("check")) {
149155
await editChannels(interaction, channels);

0 commit comments

Comments
 (0)