misc changes
This commit is contained in:
		
							parent
							
								
									e7715b75cf
								
							
						
					
					
						commit
						58ad6fcd3d
					
				
					 1 changed files with 5 additions and 4 deletions
				
			
		|  | @ -1,14 +1,15 @@ | ||||||
|  | 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 { | ||||||
|   name: string |   name: string | ||||||
|   match: CommandArgumentMatchTypes |   match: CommandArgumentMatchTypes | ||||||
|   type?: unknown // Still needs to be implemented
 |   // Still needs to be implemented
 | ||||||
|   defaultValue?: unknown // Still needs to be implemented
 |   // type?: unknown
 | ||||||
|  |   defaultValue?: string; | ||||||
|   flag?: string |   flag?: string | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| const mentionRegex = /([0-9]{18})/g |  | ||||||
| 
 | 
 | ||||||
| export function parseArgs( | export function parseArgs( | ||||||
|   commandArgs: Args[] | undefined, |   commandArgs: Args[] | undefined, | ||||||
|  | @ -56,7 +57,7 @@ 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 = mentionRegex.exec(argsNullable[index]!)![0] |   const mention = MessageMentions.USER_MENTION.exec(argsNullable[index]!)![0] | ||||||
|   argsNullable[index] = null |   argsNullable[index] = null | ||||||
|   args[entry.name] = mention |   args[entry.name] = mention | ||||||
| } | } | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue