Fix isbotPmc isBotBoss and isBotFollower failing when undefined values are passed in

This commit is contained in:
Dev 2023-11-05 20:29:10 +00:00
parent df6a08367b
commit 32b356d3f1

View File

@ -66,17 +66,17 @@ export class BotHelper
*/ */
public isBotPmc(botRole: string): boolean public isBotPmc(botRole: string): boolean
{ {
return (["usec", "bear", "pmc", "sptbear", "sptusec"].includes(botRole.toLowerCase())); return (["usec", "bear", "pmc", "sptbear", "sptusec"].includes(botRole?.toLowerCase()));
} }
public isBotBoss(botRole: string): boolean public isBotBoss(botRole: string): boolean
{ {
return this.botConfig.bosses.some(x => x.toLowerCase() === botRole.toLowerCase()); return this.botConfig.bosses.some(x => x.toLowerCase() === botRole?.toLowerCase());
} }
public isBotFollower(botRole: string): boolean public isBotFollower(botRole: string): boolean
{ {
return botRole.toLowerCase().startsWith("follower"); return botRole?.toLowerCase().startsWith("follower");
} }
/** /**