@sapphire/plugin-subcommands 4.3.0 → 4.3.1-next.1d6be8a.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import type { Command } from '@sapphire/framework';
|
|
2
|
-
export type SubcommandMapping = SubcommandMappingMethod | SubcommandMappingGroup;
|
|
3
|
-
export type SubcommandMappingArray = SubcommandMapping[];
|
|
4
|
-
/**
|
|
5
|
-
* Describes the mapping of all the subcommands to their respective implementations for this command.
|
|
6
|
-
*/
|
|
7
|
-
interface SubcommandMappingBase {
|
|
8
|
-
/**
|
|
9
|
-
* The name of this subcommand, or subcommand group
|
|
10
|
-
*/
|
|
11
|
-
name: string;
|
|
12
|
-
/**
|
|
13
|
-
* Whether this subcommand mapping describes a `'method'` or `'group'`
|
|
14
|
-
* @default 'method'
|
|
15
|
-
*/
|
|
16
|
-
type?: 'group' | 'method';
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Describes how a subcommand method maps to the actual implementation of that subcommand.
|
|
20
|
-
*/
|
|
21
|
-
export interface SubcommandMappingMethod extends SubcommandMappingBase, Pick<Command.Options, 'runIn' | 'preconditions'> {
|
|
22
|
-
/**
|
|
23
|
-
* This subcommand mapping describes a subcommand method and can therefore only ever be `'method'`
|
|
24
|
-
*/
|
|
25
|
-
type?: 'method';
|
|
26
|
-
/**
|
|
27
|
-
* Whether this is the default subcommand when none is provided.
|
|
28
|
-
*
|
|
29
|
-
* Note that this is effectively only used for Message based subcommand
|
|
30
|
-
* (those implementing {@link SubcommandMappingMethod.messageRun})
|
|
31
|
-
* because the subcommand is always provided for chat input commands.
|
|
32
|
-
*/
|
|
33
|
-
default?: boolean;
|
|
34
|
-
/**
|
|
35
|
-
* The class method to call when invoking this subcommand through a **message command**,
|
|
36
|
-
* or a callback implementation of the subcommand.
|
|
37
|
-
*
|
|
38
|
-
* Note that when providing a string you have to first define the method that will be called within your function
|
|
39
|
-
* before this will allow any values. This is to ensure that the property is strictly typed to the context of the
|
|
40
|
-
* class.
|
|
41
|
-
*
|
|
42
|
-
* @example
|
|
43
|
-
* ```typescript
|
|
44
|
-
* messageRun: 'runAdminConfig'
|
|
45
|
-
* ```
|
|
46
|
-
*
|
|
47
|
-
* @example
|
|
48
|
-
* ```typescript
|
|
49
|
-
* messageRun(message: Message) {
|
|
50
|
-
* return message.reply(`<@${message.author.id}> has been granted admin`);
|
|
51
|
-
* }
|
|
52
|
-
* ```
|
|
53
|
-
*/
|
|
54
|
-
messageRun?: string | Command['messageRun'];
|
|
55
|
-
/**
|
|
56
|
-
* The class method to call when invoking this subcommand through a **chat input command**,
|
|
57
|
-
* or a callback implementation of the subcommand.
|
|
58
|
-
*
|
|
59
|
-
* Note that when providing a string you have to first define the method that will be called within your function
|
|
60
|
-
* before this will allow any values. This is to ensure that the property is strictly typed to the context of the
|
|
61
|
-
* class.
|
|
62
|
-
*
|
|
63
|
-
* @example
|
|
64
|
-
* ```typescript
|
|
65
|
-
* chatInputRun: 'runModeratorConfig'
|
|
66
|
-
* ```
|
|
67
|
-
*
|
|
68
|
-
* @example
|
|
69
|
-
* ```typescript
|
|
70
|
-
* chatInputRun(interaction: Subcommand.Interaction) {
|
|
71
|
-
* return interaction.reply(`<@${interaction.user.id}> has been granted moderator`);
|
|
72
|
-
* }
|
|
73
|
-
* ```
|
|
74
|
-
*/
|
|
75
|
-
chatInputRun?: string | Command['chatInputRun'];
|
|
76
|
-
}
|
|
77
|
-
export interface SubcommandMappingGroup extends SubcommandMappingBase {
|
|
78
|
-
/**
|
|
79
|
-
* This subcommand mapping describes a subcommand group and can therefore only ever be `'group'`
|
|
80
|
-
*/
|
|
81
|
-
type: 'group';
|
|
82
|
-
/**
|
|
83
|
-
* The {@link SubcommandMappingMethod}s that are contained within this subcommand group.
|
|
84
|
-
*/
|
|
85
|
-
entries: SubcommandMappingMethod[];
|
|
86
|
-
}
|
|
87
|
-
export type MessageSubcommandMappingMethod = Omit<SubcommandMappingMethod, 'messageRun'> & Required<Pick<SubcommandMappingMethod, 'messageRun'>>;
|
|
88
|
-
export type ChatInputCommandSubcommandMappingMethod = Omit<SubcommandMappingMethod, 'chatInputRun'> & Required<Pick<SubcommandMappingMethod, 'chatInputRun'>>;
|
|
89
|
-
export {};
|
|
90
|
-
//# sourceMappingURL=SubcommandMappings.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SubcommandMappings.d.ts","sourceRoot":"","sources":["../../src/lib/SubcommandMappings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEnD,MAAM,MAAM,iBAAiB,GAAG,uBAAuB,GAAG,sBAAsB,CAAC;AAEjF,MAAM,MAAM,sBAAsB,GAAG,iBAAiB,EAAE,CAAC;AAEzD;;GAEG;AACH,UAAU,qBAAqB;IAC9B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,uBAAwB,SAAQ,qBAAqB,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,eAAe,CAAC;IACvH;;OAEG;IACH,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;;;;;;;;;;;;;;;OAmBG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IAC5C;;;;;;;;;;;;;;;;;;;OAmBG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;CAChD;AAED,MAAM,WAAW,sBAAuB,SAAQ,qBAAqB;IACpE;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC;IACd;;OAEG;IACH,OAAO,EAAE,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