From ffd86fe236df9d2c62b387fbfc5fbc3dbb897107 Mon Sep 17 00:00:00 2001 From: toast-ts <96593068+toast-ts@users.noreply.github.com> Date: Sat, 13 Apr 2024 20:07:10 +1000 Subject: [PATCH] Attempt to fix annoying automod error --- src/helpers/MessageTool.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/helpers/MessageTool.ts b/src/helpers/MessageTool.ts index 55c2f89..a2ac4bf 100644 --- a/src/helpers/MessageTool.ts +++ b/src/helpers/MessageTool.ts @@ -11,7 +11,7 @@ export default class MessageTool { } public static concatMessage =(...messages:string[])=>messages.join('\n'); public static formatMention =(mention:string, type:'user'|'channel'|'role')=>`<${type === 'role' ? '@&' : type === 'channel' ? '#' : '@'}${mention}>`; - public static isStaff =(guildMember:Discord.GuildMember)=>config.dcServer.staffRoles.map((x:string)=>config.dcServer.roles[x]).some((x:string)=>guildMember.roles.cache.has(x)); + public static isStaff =(guildMember:Discord.GuildMember)=>config.dcServer.staffRoles.map((x:string)=>config.dcServer.roles[x]).some((x:string)=>guildMember.roles?.cache?.has(x)); public static youNeedRole =(interaction:Discord.CommandInteraction, role:keyof typeof config.dcServer.roles)=>interaction.reply(`You do not have ${this.formatMention(config.dcServer.roles[role], 'role')} role to use this command.`); public static isModerator =(guildMember:Discord.GuildMember)=>config.dcServer.staffRoles.filter((x:string)=>/^admin|^dcmod/.test(x)).map((x:string)=>config.dcServer.roles[x]).some((x:string)=>guildMember.roles.cache.has(x)); public static isWhitelisted =(interaction:Discord.CommandInteraction)=>interaction.reply('You are not on whitelist!')