misc changes

This commit is contained in:
mierenmanz 2021-04-28 15:09:39 +02:00
parent e7715b75cf
commit 58ad6fcd3d
1 changed files with 5 additions and 4 deletions

View File

@ -1,14 +1,15 @@
import { MessageMentions } from "../structures/messageMentions.ts";
export type CommandArgumentMatchTypes = 'flag' | 'mention' | 'content' | 'rest'
export interface Args {
name: string
match: CommandArgumentMatchTypes
type?: unknown // Still needs to be implemented
defaultValue?: unknown // Still needs to be implemented
// Still needs to be implemented
// type?: unknown
defaultValue?: string;
flag?: string
}
const mentionRegex = /([0-9]{18})/g
export function parseArgs(
commandArgs: Args[] | undefined,
@ -56,7 +57,7 @@ function parseMention(
argsNullable: Array<string | null>
): void {
const index = argsNullable.findIndex((x) => typeof x === 'string')
const mention = mentionRegex.exec(argsNullable[index]!)![0]
const mention = MessageMentions.USER_MENTION.exec(argsNullable[index]!)![0]
argsNullable[index] = null
args[entry.name] = mention
}