fix test
This commit is contained in:
parent
1c25e2d3a1
commit
eac9c4bceb
1 changed files with 7 additions and 5 deletions
|
@ -1,4 +1,4 @@
|
||||||
import { MessageMentions } from "../structures/messageMentions.ts";
|
import { MessageMentions } from '../structures/messageMentions.ts'
|
||||||
export type CommandArgumentMatchTypes = 'flag' | 'mention' | 'content' | 'rest'
|
export type CommandArgumentMatchTypes = 'flag' | 'mention' | 'content' | 'rest'
|
||||||
|
|
||||||
export interface Args {
|
export interface Args {
|
||||||
|
@ -6,11 +6,10 @@ export interface Args {
|
||||||
match: CommandArgumentMatchTypes
|
match: CommandArgumentMatchTypes
|
||||||
// Still needs to be implemented
|
// Still needs to be implemented
|
||||||
// type?: unknown
|
// type?: unknown
|
||||||
defaultValue?: string;
|
defaultValue?: string
|
||||||
flag?: string
|
flag?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export function parseArgs(
|
export function parseArgs(
|
||||||
commandArgs: Args[] | undefined,
|
commandArgs: Args[] | undefined,
|
||||||
messageArgs: string[]
|
messageArgs: string[]
|
||||||
|
@ -57,9 +56,12 @@ function parseMention(
|
||||||
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')
|
||||||
const mention = MessageMentions.USER_MENTION.exec(argsNullable[index]!)![0]
|
const regexMatches = MessageMentions.USER_MENTION.exec(argsNullable[index]!)
|
||||||
|
args[entry.name] =
|
||||||
|
regexMatches !== null
|
||||||
|
? regexMatches[0].replace(MessageMentions.USER_MENTION, '$1')
|
||||||
|
: null
|
||||||
argsNullable[index] = null
|
argsNullable[index] = null
|
||||||
args[entry.name] = mention
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseContent(
|
function parseContent(
|
||||||
|
|
Loading…
Reference in a new issue