Skip to content

Commit 4e47906

Browse files
committed
avoid improper shadowing
1 parent 065d073 commit 4e47906

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

commands/owner/csCreateChannels.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -163,15 +163,17 @@ export default {
163163
courses[index].save();
164164

165165
// Ping members who have this role
166-
const role = msgInt.guild.roles.cache.find((role) => {
166+
const found_role = msgInt.guild.roles.cache.find((role) => {
167167
return (
168168
cleanRoleString(role.name) ==
169169
cleanChannelString(courses[index].CODE)
170170
);
171171
});
172-
if (role !== undefined) {
172+
if (found_role !== undefined) {
173173
//Ping member
174-
new_channel.send(`Hey! <@&${role.id}> here is a channel for you!`);
174+
new_channel.send(
175+
`Hey! <@&${found_role.id}> here is a channel for you!`
176+
);
175177
}
176178
} else if (
177179
channel.parent !== null &&
@@ -194,15 +196,17 @@ export default {
194196
courses[index].CHANNEL_ID = channel.id;
195197
courses[index].save();
196198
// Ping members who have this role
197-
const role = msgInt.guild.roles.cache.find((role) => {
199+
const found_role = msgInt.guild.roles.cache.find((role) => {
198200
return (
199201
cleanRoleString(role.name) ==
200202
cleanChannelString(courses[index].CODE)
201203
);
202204
});
203-
if (role !== undefined) {
205+
if (found_role !== undefined) {
204206
//Ping member
205-
channel.send(`Hey! <@&${role.id}> here is the channel for you!`);
207+
channel.send(
208+
`Hey! <@&${found_role.id}> here is the channel for you!`
209+
);
206210
}
207211
} else if (
208212
channel.parent !== null &&
@@ -239,3 +243,4 @@ export default {
239243
);
240244
},
241245
} as ICommand;
246+

utils/channels.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,20 @@ export function checkForChannel(guild: Guild, channel_name: string) {
1616
}
1717

1818
export async function findCategory(guild: Guild, category_name: string) {
19-
let category = guild.channels.cache.find((category) => {
19+
let found_category = guild.channels.cache.find((category) => {
2020
return category.name === category_name;
2121
});
2222

23-
if (category === undefined || category.type !== "GUILD_CATEGORY") {
24-
category = await guild.channels.create(category_name, {
23+
if (
24+
found_category === undefined ||
25+
found_category.type !== "GUILD_CATEGORY"
26+
) {
27+
found_category = await guild.channels.create(category_name, {
2528
type: "GUILD_CATEGORY",
2629
});
2730
}
2831

29-
return category;
32+
return found_category;
3033
}
3134
export async function createTextChannel(
3235
guild: Guild,

0 commit comments

Comments
 (0)