@@ -6,22 +6,24 @@ declare module 'discord.js-commando' {
66
77 private obtainInfinite ( msg : CommandoMessage , vals ?: string [ ] , promptLimit ?: number ) : Promise < ArgumentResult > ;
88
9- private static validateInfo ( client : CommandoClient , info : ArgumentInfo ) ;
9+ private static validateInfo ( client : CommandoClient , info : ArgumentInfo ) : void ;
1010
11- public default : any ;
11+ public default : ArgumentDefault ;
12+ public emptyChecker : Function ;
1213 public error : string ;
1314 public infinite : boolean ;
1415 public key : string ;
1516 public label : string ;
1617 public max : number ;
1718 public min : number ;
18- public oneOf : any [ ] ;
19+ public oneOf : string [ ] ;
1920 public parser : Function ;
2021 public prompt : string ;
2122 public type : ArgumentType ;
2223 public validator : Function ;
2324 public wait : number ;
2425
26+ public isEmpty ( val : string , msg : CommandoMessage ) : boolean ;
2527 public obtain ( msg : CommandoMessage , val ?: string , promptLimit ?: number ) : Promise < ArgumentResult > ;
2628 public parse ( val : string , msg : CommandoMessage ) : any | Promise < any > ;
2729 public validate ( val : string , msg : CommandoMessage ) : boolean | string | Promise < boolean | string > ;
@@ -37,22 +39,25 @@ declare module 'discord.js-commando' {
3739 public obtain ( msg : CommandoMessage , provided ?: any [ ] , promptLimit ?: number ) : Promise < ArgumentCollectorResult > ;
3840 }
3941
40- export class ArgumentType {
42+ export abstract class ArgumentType {
4143 public constructor ( client : CommandoClient , id : string ) ;
4244
4345 public readonly client : CommandoClient ;
4446 public id : string ;
4547
46- public parse ( val : string , msg : CommandoMessage , arg : Argument ) : any | Promise < any > ;
47- public validate ( val : string , msg : CommandoMessage , arg : Argument ) : boolean | string | Promise < boolean | string > ;
4848 public isEmpty ( val : string , msg : CommandoMessage , arg : Argument ) : boolean ;
49+ public abstract parse ( val : string , msg : CommandoMessage , arg : Argument ) : any | Promise < any > ;
50+ public abstract validate ( val : string , msg : CommandoMessage , arg : Argument ) : boolean | string | Promise < boolean | string > ;
4951 }
5052
5153 export class ArgumentUnionType extends ArgumentType {
5254 public types : ArgumentType [ ] ;
55+
56+ public parse ( val : string , msg : CommandoMessage , arg : Argument ) : any | Promise < any > ;
57+ public validate ( val : string , msg : CommandoMessage , arg : Argument ) : string | boolean | Promise < string | boolean > ;
5358 }
5459
55- export class Command {
60+ export abstract class Command {
5661 public constructor ( client : CommandoClient , info : CommandInfo ) ;
5762
5863 private _globalEnabled : boolean ;
@@ -63,6 +68,7 @@ declare module 'discord.js-commando' {
6368 private static validateInfo ( client : CommandoClient , info : CommandInfo ) ;
6469
6570 public aliases : string [ ] ;
71+ public argsCollector : ArgumentCollector ;
6672 public argsCount : number ;
6773 public argsSingleQuotes : boolean ;
6874 public argsType : string ;
@@ -76,8 +82,8 @@ declare module 'discord.js-commando' {
7682 public group : CommandGroup ;
7783 public groupID : string ;
7884 public guarded : boolean ;
79- public hidden : boolean ;
8085 public guildOnly : boolean ;
86+ public hidden : boolean ;
8187 public memberName : string ;
8288 public name : string ;
8389 public nsfw : boolean ;
@@ -89,7 +95,7 @@ declare module 'discord.js-commando' {
8995
9096 public hasPermission ( message : CommandoMessage , ownerOverride ?: boolean ) : boolean | string ;
9197 public isEnabledIn ( guild : GuildResolvable , bypassGroup ?: boolean ) : boolean ;
92- public isUsable ( message : Message ) : boolean ;
98+ public isUsable ( message ? : Message ) : boolean ;
9399 public onBlock ( message : CommandoMessage , reason : string , data ?: object ) : Promise < Message | Message [ ] > ;
94100 public onBlock ( message : CommandoMessage , reason : 'guildOnly' | 'nsfw' ) : Promise < Message | Message [ ] > ;
95101 public onBlock ( message : CommandoMessage , reason : 'permission' , data : { response ?: string } ) : Promise < Message | Message [ ] > ;
@@ -98,7 +104,7 @@ declare module 'discord.js-commando' {
98104 public onError ( err : Error , message : CommandoMessage , args : object | string | string [ ] , fromPattern : false , result ?: ArgumentCollectorResult ) : Promise < Message | Message [ ] > ;
99105 public onError ( err : Error , message : CommandoMessage , args : string [ ] , fromPattern : true , result ?: ArgumentCollectorResult ) : Promise < Message | Message [ ] > ;
100106 public reload ( ) : void ;
101- public run ( message : CommandoMessage , args : object | string | string [ ] , fromPattern : boolean , result ?: ArgumentCollectorResult ) : Promise < Message | Message [ ] | null > | null ;
107+ public abstract run ( message : CommandoMessage , args : object | string | string [ ] , fromPattern : boolean , result ?: ArgumentCollectorResult ) : Promise < Message | Message [ ] | null > | null ;
102108 public setEnabledIn ( guild : GuildResolvable , enabled : boolean ) : void ;
103109 public unload ( ) : void ;
104110 public usage ( argString ?: string , prefix ?: string , user ?: User ) : string ;
@@ -115,9 +121,9 @@ declare module 'discord.js-commando' {
115121
116122 private buildCommandPattern ( prefix : string ) : RegExp ;
117123 private cacheCommandoMessage ( message : Message , oldMessage : Message , cmdMsg : CommandoMessage , responses : Message | Message [ ] ) : void ;
118- private handleMessage ( messge : Message , oldMessage ?: Message ) : Promise < void > ;
124+ private handleMessage ( message : Message , oldMessage ?: Message ) : Promise < void > ;
119125 private inhibit ( cmdMsg : CommandoMessage ) : Inhibition ;
120- private matchDefault ( message : Message , pattern : RegExp , commandNameIndex : number ) : CommandoMessage ;
126+ private matchDefault ( message : Message , pattern : RegExp , commandNameIndex ? : number , prefixless ?: boolean ) : CommandoMessage ;
121127 private parseMessage ( message : Message ) : CommandoMessage ;
122128 private shouldHandleMessage ( message : Message , oldMessage ?: Message ) : boolean ;
123129
@@ -134,7 +140,7 @@ declare module 'discord.js-commando' {
134140 }
135141
136142 export class CommandGroup {
137- public constructor ( client : CommandoClient , id : string , name ?: string , guarded ?: boolean , commands ?: Command [ ] ) ;
143+ public constructor ( client : CommandoClient , id : string , name ?: string , guarded ?: boolean ) ;
138144
139145 public readonly client : CommandoClient ;
140146 public commands : Collection < string , Command >
@@ -164,10 +170,10 @@ declare module 'discord.js-commando' {
164170 public anyUsage ( argString ?: string , prefix ?: string , user ?: User ) : string ;
165171 public code : CommandoMessage [ 'say' ] ;
166172 public direct : CommandoMessage [ 'say' ] ;
167- public embed ( embed : MessageEmbed , content ?: string , options ?: MessageOptions | MessageAdditions ) ;
173+ public embed ( embed : MessageEmbed , content ?: StringResolvable , options ?: ( MessageOptions & { split ?: false } ) | MessageAdditions ) : Promise < CommandoMessage > ;
174+ public embed ( embed : MessageEmbed , content ?: StringResolvable , options ?: ( MessageOptions & { split : true | Exclude < MessageOptions [ 'split' ] , boolean > } ) | MessageAdditions ) : Promise < CommandoMessage [ ] > ;
168175 public initCommand ( command ?: Command , argString ?: string [ ] , patternMatches ?: string [ ] ) : this;
169176 public parseArgs ( ) : string | string [ ] ;
170- public static parseArgs ( argString : string , argCount ?: number , allowSingleQuote ?: boolean ) : string [ ] ;
171177 public replyEmbed : CommandoMessage [ 'embed' ] ;
172178 public run ( ) : Promise < null | CommandoMessage | CommandoMessage [ ] > ;
173179 public say (
@@ -179,6 +185,8 @@ declare module 'discord.js-commando' {
179185 options ?: ( MessageOptions & { split : true | Exclude < MessageOptions [ 'split' ] , boolean > } ) | MessageAdditions
180186 ) : Promise < CommandoMessage [ ] > ;
181187 public usage ( argString ?: string , prefix ?: string , user ?: User ) : string ;
188+
189+ public static parseArgs ( argString : string , argCount ?: number , allowSingleQuote ?: boolean ) : string [ ] ;
182190 }
183191
184192 export class CommandoClient extends Client {
@@ -214,7 +222,7 @@ declare module 'discord.js-commando' {
214222 public readonly settings : GuildSettingsHelper ;
215223
216224 public commandUsage ( command ?: string , user ?: User ) : string ;
217- public isCommandEndabled ( command : CommandResolvable ) : boolean ;
225+ public isCommandEnabled ( command : CommandResolvable ) : boolean ;
218226 public isGroupEnabled ( group : CommandGroupResolvable ) : boolean ;
219227 public setCommandEnabled ( command : CommandResolvable , enabled : boolean ) : void ;
220228 public setGroupEnabled ( group : CommandGroupResolvable , enabled : boolean ) : void ;
@@ -226,7 +234,6 @@ declare module 'discord.js-commando' {
226234 public readonly client : CommandoClient ;
227235 public commands : Collection < string , Command > ;
228236 public commandsPath : string ;
229- public evalObjects : object ;
230237 public groups : Collection < string , CommandGroup > ;
231238 public types : Collection < string , ArgumentType > ;
232239 public unknownCommand ?: Command ;
@@ -236,20 +243,18 @@ declare module 'discord.js-commando' {
236243 public registerCommand ( command : Command | Function ) : CommandoRegistry ;
237244 public registerCommands ( commands : Command [ ] | Function [ ] , ignoreInvalid ?: boolean ) : CommandoRegistry ;
238245 public registerCommandsIn ( options : string | { } ) : CommandoRegistry ;
239- public registerDefaultCommands ( commands ?: { help ?: boolean , prefix ?: boolean , eval ?: boolean , ping ?: boolean , commandState ?: boolean , unknownCommand ?: boolean } ) : CommandoRegistry ;
246+ public registerDefaultCommands ( commands ?: DefaultCommandsOptions ) : CommandoRegistry ;
240247 public registerDefaultGroups ( ) : CommandoRegistry ;
241248 public registerDefaults ( ) : CommandoRegistry ;
242- public registerDefaultTypes ( types ?: { string ?: boolean , integer ?: boolean , float ?: boolean , boolean ?: boolean , user ?: boolean , member ?: boolean , role ?: boolean , channel ?: boolean , message ?: boolean , defaultEmoji ?: boolean , command ?: boolean , group ?: boolean } ) : CommandoRegistry ;
243- public registerEvalObject ( key : string , obj : { } ) : CommandoRegistry ;
244- public registerEvalObjects ( obj : { } ) : CommandoRegistry ;
249+ public registerDefaultTypes ( types ?: DefaultTypesOptions ) : CommandoRegistry ;
245250 public registerGroup ( group : CommandGroup | Function | { id : string , name ?: string , guarded ?: boolean } | string , name ?: string , guarded ?: boolean ) : CommandoRegistry ;
246251 public registerGroups ( groups : CommandGroup [ ] | Function [ ] | { id : string , name ?: string , guarded ?: boolean } [ ] | string [ ] [ ] ) : CommandoRegistry ;
247252 public registerType ( type : ArgumentType | Function ) : CommandoRegistry ;
248253 public registerTypes ( type : ArgumentType [ ] | Function [ ] , ignoreInvalid ?: boolean ) : CommandoRegistry ;
249254 public registerTypesIn ( options : string | { } ) : CommandoRegistry ;
250255 public reregisterCommand ( command : Command | Function , oldCommand : Command ) : void ;
251256 public resolveCommand ( command : CommandResolvable ) : Command ;
252- public resolveCommandPath ( groups : string , memberName : string ) : string ;
257+ public resolveCommandPath ( group : string , memberName : string ) : string ;
253258 public resolveGroup ( group : CommandGroupResolvable ) : CommandGroup ;
254259 public unregisterCommand ( command : Command ) : void ;
255260 }
@@ -270,14 +275,15 @@ declare module 'discord.js-commando' {
270275 public set ( key : string , val : any ) : Promise < any > ;
271276 }
272277
273- export class SettingProvider {
274- public clear ( guild : Guild | string ) : Promise < void > ;
275- public destroy ( ) : Promise < void > ;
276- public get ( guild : Guild | string , key : string , defVal ?: any ) : any ;
278+ export abstract class SettingProvider {
279+ public abstract clear ( guild : Guild | string ) : Promise < void > ;
280+ public abstract destroy ( ) : Promise < void > ;
281+ public abstract get ( guild : Guild | string , key : string , defVal ?: any ) : any ;
282+ public abstract init ( client : CommandoClient ) : Promise < void > ;
283+ public abstract remove ( guild : Guild | string , key : string ) : Promise < any > ;
284+ public abstract set ( guild : Guild | string , key : string , val : any ) : Promise < any > ;
285+
277286 public static getGuildID ( guild : Guild | string ) : string ;
278- public init ( client : CommandoClient ) : Promise < void > ;
279- public remove ( guild : Guild | string , key : string ) : Promise < any > ;
280- public set ( guild : Guild | string , key : string , val : any ) : Promise < any > ;
281287 }
282288
283289 export class SQLiteProvider extends SettingProvider {
@@ -326,6 +332,7 @@ declare module 'discord.js-commando' {
326332
327333 export class util {
328334 public static disambiguation ( items : any [ ] , label : string , property ?: string ) : string ;
335+ public static escapeRegex ( str : string ) : string ;
329336 public static paginate < T > ( items : T [ ] , page ?: number , pageLength ?: number ) : {
330337 items : T [ ] ,
331338 page : number ,
@@ -344,6 +351,8 @@ declare module 'discord.js-commando' {
344351 answers : Message [ ] ;
345352 }
346353
354+ type ArgumentDefault = any | Function ;
355+
347356 export interface ArgumentInfo {
348357 key : string ;
349358 label ?: string ;
@@ -352,8 +361,8 @@ declare module 'discord.js-commando' {
352361 type ?: string ;
353362 max ?: number ;
354363 min ?: number ;
355- oneOf ?: any [ ] ;
356- default ?: any | Function ;
364+ oneOf ?: string [ ] ;
365+ default ?: ArgumentDefault ;
357366 infinite ?: boolean ;
358367 validate ?: Function ;
359368 parse ?: Function ;
@@ -432,7 +441,36 @@ declare module 'discord.js-commando' {
432441
433442 type CommandResolvable = Command | string ;
434443
444+ interface DefaultCommandsOptions {
445+ help ?: boolean ;
446+ prefix ?: boolean ;
447+ eval ?: boolean ;
448+ ping ?: boolean ;
449+ unknownCommand ?: boolean ;
450+ commandState ?: boolean ;
451+ }
452+
453+ interface DefaultTypesOptions {
454+ string ?: boolean ;
455+ integer ?: boolean ;
456+ float ?: boolean ;
457+ boolean ?: boolean ;
458+ user ?: boolean ;
459+ member ?: boolean ;
460+ role ?: boolean ;
461+ channel ?: boolean ;
462+ textChannel ?: boolean ;
463+ voiceChannel ?: boolean ;
464+ categoryChannel ?: boolean ;
465+ message ?: boolean ;
466+ customEmoji ?: boolean ;
467+ defaultEmoji ?: boolean ;
468+ command ?: boolean ;
469+ group ?: boolean ;
470+ }
471+
435472 type Inhibitor = ( msg : CommandoMessage ) => false | string | Inhibition ;
473+
436474 export interface Inhibition {
437475 reason : string ;
438476 response ?: Promise < Message > ;
0 commit comments