From 0288e2f4de4f7de15e439876b00d4de093eae0ec Mon Sep 17 00:00:00 2001 From: Nyo <58821897+ItsNyoty@users.noreply.github.com> Date: Tue, 12 May 2026 16:30:12 +0200 Subject: [PATCH] Normalize channel, role, and category name comparisons --- Structures/Client.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Structures/Client.js b/Structures/Client.js index 57ff112..97392d6 100644 --- a/Structures/Client.js +++ b/Structures/Client.js @@ -60,26 +60,29 @@ class Client extends Discord.Client { async getChannel(channel, guild) { if (!channel) return null; + const channelStr = String(channel).toLowerCase(); return guild.channels.cache.find( (c) => (c.type === Discord.ChannelType.GuildText || c.type === Discord.ChannelType.GuildNews) && - (c.id === channel || (c.name && c.name.toLowerCase() === channel.toLowerCase())), + (c.id === channel || (c.name && c.name.toLowerCase() === channelStr)), ); } async getRole(role, guild) { if (!role) return null; + const roleStr = String(role).toLowerCase(); return guild.roles.cache.find( - (r) => r.id === role || (r.name && r.name.toLowerCase() === role.toLowerCase()), + (r) => r.id === role || (r.name && r.name.toLowerCase() === roleStr), ); } async getCategory(category, guild) { if (!category) return null; + const catStr = String(category).toLowerCase(); return guild.channels.cache.find( (c) => c.type === Discord.ChannelType.GuildCategory && - (c.id === category || (c.name && c.name.toLowerCase() === category.toLowerCase())), + (c.id === category || (c.name && c.name.toLowerCase() === catStr)), ); }