don't assume that the first string found is a mention

This commit is contained in:
mierenmanz 2021-04-29 11:05:31 +02:00
parent 9d6feaff8d
commit b3220fa155

View file

@ -55,7 +55,9 @@ function parseMention(
entry: Args, entry: Args,
argsNullable: Array<string | null> argsNullable: Array<string | null>
): void { ): void {
const index = argsNullable.findIndex((x) => typeof x === 'string') const index = argsNullable.findIndex(
(x) => typeof x === 'string' && x.includes('<@!')
)
const regexMatches = MessageMentions.USER_MENTION.exec(argsNullable[index]!) const regexMatches = MessageMentions.USER_MENTION.exec(argsNullable[index]!)
args[entry.name] = args[entry.name] =
regexMatches !== null regexMatches !== null