mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-25 03:29:51 +01:00
feat: only interpret correctly formatter usernames
This commit is contained in:
1 parent
d2319688a5
commit
254392370f
1 file changed
+2
-1
@@ -1,6 +1,7 @@
|
|||||||
import { CacheType, ChatInputCommandInteraction } from 'discord.js';
|
import { CacheType, ChatInputCommandInteraction } from 'discord.js';
|
||||||
import { Region } from '../../constants/regions';
|
import { Region } from '../../constants/regions';
|
||||||
import listPlayers, {
|
import listPlayers, {
|
||||||
|
usernamePattern,
|
||||||
usernamePatternWithoutPosition,
|
usernamePatternWithoutPosition,
|
||||||
} from '../blitz/listPlayers';
|
} from '../blitz/listPlayers';
|
||||||
import throwError from '../node/throwError';
|
import throwError from '../node/throwError';
|
||||||
@@ -19,7 +20,7 @@ export default async function resolvePlayerFromCommand(
|
|||||||
const displayName = interaction.guild?.members.cache
|
const displayName = interaction.guild?.members.cache
|
||||||
.get(interaction.user.id)
|
.get(interaction.user.id)
|
||||||
?.displayName.match(usernamePatternWithoutPosition)?.[0];
|
?.displayName.match(usernamePatternWithoutPosition)?.[0];
|
||||||
const username = commandUsername ?? displayName;
|
const username = commandUsername?.match(usernamePattern)?.[0] ?? displayName;
|
||||||
|
|
||||||
if (username === undefined) {
|
if (username === undefined) {
|
||||||
throw throwError(
|
throw throwError(
|
||||||
|
|||||||
Reference in new issue
Block a user