From 254392370f134501c1eb45f376ad4e25b8e3cf57 Mon Sep 17 00:00:00 2001 From: tresabhi Date: Wed, 9 Aug 2023 17:27:38 +0000 Subject: [PATCH] feat: only interpret correctly formatter usernames --- src/core/discord/resolvePlayerFromCommand.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core/discord/resolvePlayerFromCommand.ts b/src/core/discord/resolvePlayerFromCommand.ts index 1452e6bc8..3cfee5ccb 100644 --- a/src/core/discord/resolvePlayerFromCommand.ts +++ b/src/core/discord/resolvePlayerFromCommand.ts @@ -1,6 +1,7 @@ import { CacheType, ChatInputCommandInteraction } from 'discord.js'; import { Region } from '../../constants/regions'; import listPlayers, { + usernamePattern, usernamePatternWithoutPosition, } from '../blitz/listPlayers'; import throwError from '../node/throwError'; @@ -19,7 +20,7 @@ export default async function resolvePlayerFromCommand( const displayName = interaction.guild?.members.cache .get(interaction.user.id) ?.displayName.match(usernamePatternWithoutPosition)?.[0]; - const username = commandUsername ?? displayName; + const username = commandUsername?.match(usernamePattern)?.[0] ?? displayName; if (username === undefined) { throw throwError(