cordo 1.15.2 → 1.16.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/.eslintrc.js +11 -11
- package/README.md +97 -97
- package/dist/api.d.ts +27 -27
- package/dist/api.js +211 -216
- package/dist/api.js.map +1 -1
- package/dist/express-middleware.d.ts +2 -2
- package/dist/express-middleware.js +14 -14
- package/dist/index.d.ts +48 -48
- package/dist/index.js +191 -191
- package/dist/lib/default-logger.d.ts +7 -7
- package/dist/lib/default-logger.js +10 -10
- package/dist/lib/permission-checks.d.ts +5 -5
- package/dist/lib/permission-checks.js +48 -48
- package/dist/lib/permission-strings.d.ts +48 -48
- package/dist/lib/permission-strings.js +66 -66
- package/dist/lib/user-error-messages.d.ts +7 -7
- package/dist/lib/user-error-messages.js +38 -38
- package/dist/lib/utils.d.ts +2 -2
- package/dist/lib/utils.js +20 -20
- package/dist/manager/autocompleter.d.ts +8 -8
- package/dist/manager/autocompleter.js +58 -58
- package/dist/manager/commands.d.ts +11 -11
- package/dist/manager/commands.js +100 -100
- package/dist/manager/components.d.ts +11 -11
- package/dist/manager/components.js +109 -109
- package/dist/manager/states.d.ts +12 -12
- package/dist/manager/states.js +56 -56
- package/dist/replies.d.ts +18 -18
- package/dist/replies.js +238 -232
- package/dist/replies.js.map +1 -1
- package/dist/src/api.d.ts +27 -27
- package/dist/src/api.js +193 -193
- package/dist/src/index.d.ts +47 -47
- package/dist/src/index.js +184 -184
- package/dist/src/lib/default-logger.d.ts +7 -7
- package/dist/src/lib/default-logger.js +10 -10
- package/dist/src/lib/permission-checks.d.ts +5 -5
- package/dist/src/lib/permission-checks.js +48 -48
- package/dist/src/lib/permission-strings.d.ts +48 -48
- package/dist/src/lib/permission-strings.js +66 -66
- package/dist/src/lib/user-error-messages.d.ts +7 -7
- package/dist/src/lib/user-error-messages.js +38 -38
- package/dist/src/lib/utils.d.ts +2 -2
- package/dist/src/lib/utils.js +20 -20
- package/dist/src/manager/autocompleter.d.ts +8 -8
- package/dist/src/manager/autocompleter.js +58 -58
- package/dist/src/manager/commands.d.ts +11 -11
- package/dist/src/manager/commands.js +100 -100
- package/dist/src/manager/components.d.ts +11 -11
- package/dist/src/manager/components.js +109 -109
- package/dist/src/manager/states.d.ts +6 -6
- package/dist/src/manager/states.js +33 -33
- package/dist/src/replies.d.ts +18 -18
- package/dist/src/replies.js +228 -228
- package/dist/src/types/base.d.ts +282 -282
- package/dist/src/types/base.js +4 -4
- package/dist/src/types/component.d.ts +55 -55
- package/dist/src/types/component.js +3 -3
- package/dist/src/types/const.d.ts +78 -78
- package/dist/src/types/const.js +91 -91
- package/dist/src/types/custom.d.ts +77 -77
- package/dist/src/types/custom.js +3 -3
- package/dist/src/types/middleware.d.ts +41 -41
- package/dist/src/types/middleware.js +2 -2
- package/dist/types/base.d.ts +301 -297
- package/dist/types/base.js +4 -4
- package/dist/types/component.d.ts +66 -66
- package/dist/types/component.js +3 -3
- package/dist/types/const.d.ts +89 -89
- package/dist/types/const.js +103 -103
- package/dist/types/custom.d.ts +82 -82
- package/dist/types/custom.js +3 -3
- package/dist/types/middleware.d.ts +41 -41
- package/dist/types/middleware.js +2 -2
- package/dist/utils.d.ts +2 -2
- package/dist/utils.js +20 -20
- package/dist/v2/_test/command.d.ts +2 -2
- package/dist/v2/_test/command.js +30 -30
- package/dist/v2/_test/general-test.d.ts +1 -1
- package/dist/v2/_test/general-test.js +24 -24
- package/dist/v2/api.js +184 -184
- package/dist/v2/components/$component.d.ts +14 -14
- package/dist/v2/components/$component.js +6 -6
- package/dist/v2/components/button-component.d.ts +31 -31
- package/dist/v2/components/button-component.js +104 -104
- package/dist/v2/components/buttons.d.ts +31 -31
- package/dist/v2/components/buttons.js +104 -104
- package/dist/v2/handler/$handler.d.ts +2 -2
- package/dist/v2/handler/$handler.js +6 -6
- package/dist/v2/handler/command-handler.d.ts +15 -15
- package/dist/v2/handler/command-handler.js +6 -6
- package/dist/v2/index.js +181 -181
- package/dist/v2/interactions/$interaction.d.ts +58 -58
- package/dist/v2/interactions/$interaction.js +35 -35
- package/dist/v2/interactions/$shared-types.d.ts +69 -69
- package/dist/v2/interactions/$shared-types.js +2 -2
- package/dist/v2/interactions/autocomplete-interaction.d.ts +13 -13
- package/dist/v2/interactions/autocomplete-interaction.js +10 -10
- package/dist/v2/interactions/command-interaction.d.ts +60 -60
- package/dist/v2/interactions/command-interaction.js +25 -25
- package/dist/v2/interactions/component-interaction.d.ts +35 -35
- package/dist/v2/interactions/component-interaction.js +12 -12
- package/dist/v2/interactions/modal-submit-interaction.d.ts +23 -23
- package/dist/v2/interactions/modal-submit-interaction.js +16 -16
- package/dist/v2/types/const.d.ts +84 -84
- package/dist/v2/types/const.js +93 -93
- package/dist/v2/types/discord.d.ts +146 -146
- package/dist/v2/types/discord.js +2 -2
- package/dist/v2/types/helper.d.ts +7 -7
- package/dist/v2/types/helper.js +2 -2
- package/dist/v2/types/interactions.d.ts +21 -21
- package/dist/v2/types/interactions.js +2 -2
- package/dist/v2/types/middleware.d.ts +11 -11
- package/dist/v2/types/middleware.js +2 -2
- package/package.json +1 -1
- package/src/api.ts +221 -226
- package/src/index.ts +207 -207
- package/src/lib/default-logger.ts +11 -11
- package/src/lib/permission-checks.ts +76 -76
- package/src/lib/permission-strings.ts +72 -72
- package/src/lib/user-error-messages.ts +43 -43
- package/src/lib/utils.ts +21 -21
- package/src/manager/autocompleter.ts +68 -68
- package/src/manager/commands.ts +116 -116
- package/src/manager/components.ts +132 -132
- package/src/manager/states.ts +64 -64
- package/src/replies.ts +267 -261
- package/src/types/base.ts +367 -365
- package/src/types/component.ts +87 -87
- package/src/types/const.ts +101 -101
- package/src/types/custom.ts +115 -115
- package/src/types/middleware.ts +45 -45
- package/tsconfig.json +27 -27
- package/v2/_test/command.ts +47 -47
- package/v2/_test/general-test.ts +34 -34
- package/v2/api.ts +193 -193
- package/v2/components/$component.ts +23 -23
- package/v2/components/button-component.ts +152 -152
- package/v2/components/select-component.ts +140 -140
- package/v2/index.ts +194 -194
- package/v2/interactions/$interaction.ts +104 -104
- package/v2/interactions/$shared-types.ts +88 -88
- package/v2/interactions/autocomplete-interaction.ts +24 -24
- package/v2/interactions/command-interaction.ts +94 -94
- package/v2/interactions/component-interaction.ts +51 -51
- package/v2/interactions/modal-submit-interaction.ts +41 -41
- package/v2/types/const.ts +135 -135
- package/v2/types/discord.ts +160 -160
- package/v2/types/helper.ts +16 -16
- package/v2/types/middleware.ts +12 -12
package/.eslintrc.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
root: true,
|
|
3
|
-
parser: '@typescript-eslint/parser',
|
|
4
|
-
env: {
|
|
5
|
-
node: true
|
|
6
|
-
},
|
|
7
|
-
plugins: [
|
|
8
|
-
'@typescript-eslint'
|
|
9
|
-
],
|
|
10
|
-
extends: 'maanex'
|
|
11
|
-
}
|
|
1
|
+
module.exports = {
|
|
2
|
+
root: true,
|
|
3
|
+
parser: '@typescript-eslint/parser',
|
|
4
|
+
env: {
|
|
5
|
+
node: true
|
|
6
|
+
},
|
|
7
|
+
plugins: [
|
|
8
|
+
'@typescript-eslint'
|
|
9
|
+
],
|
|
10
|
+
extends: 'maanex'
|
|
11
|
+
}
|
package/README.md
CHANGED
|
@@ -1,97 +1,97 @@
|
|
|
1
|
-
# Cordo
|
|
2
|
-
|
|
3
|
-
Cordo is a custom api wrapper built for interactions first. It functions as an addon on top of discord.js. Full documentation is yet to be written
|
|
4
|
-
|
|
5
|
-
Originally built for the FreeStuff Bot, this codebase could find various usecases so we decided to outsource it. Here's an [Example bot](https://github.com/Maanex/cordo-example-bot) written with it.
|
|
6
|
-
|
|
7
|
-
Or if you prefer real-life examples check out [FreeStuff Bot](https://github.com/FreeStuffBot/discord/tree/master/src/bot) or [Tudebot](https://github.com/Maanex/tudebot4/tree/master/src/cordo).
|
|
8
|
-
|
|
9
|
-
Use `npm i cordo` or `yarn add cordo` to install. Types are included.
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
## How it works (aka quick docs / tutorial)
|
|
13
|
-
|
|
14
|
-
### Commands
|
|
15
|
-
|
|
16
|
-
Go in bot/commands. They export a handler function as default which gets called when the command gets run.
|
|
17
|
-
|
|
18
|
-
### Components
|
|
19
|
-
|
|
20
|
-
Go in bot/components. They too export a handler function as default which gets called when the component gets interacted with (button press or dropdown selection).
|
|
21
|
-
You can create folders to build hierarchy. Each folder prefixes the resulting component id with the foldername and a _
|
|
22
|
-
For instance the handler in `components/foo/bar/test.ts` gets triggered for a component with the custom_id of `foo_bar_test`
|
|
23
|
-
|
|
24
|
-
### States
|
|
25
|
-
|
|
26
|
-
States are an extra layer to the Commands and Components that let you define command pages. Instead of editing or sending a response to a Command or Component Interaction, you can just ask it to take form of a state and Cordo will do the rest.
|
|
27
|
-
|
|
28
|
-
## Interaction flow
|
|
29
|
-
|
|
30
|
-
User presses button -> Check if this interaction has any overrides on timeout -> Check if there are global Component handlers -> Check if there is a state with the same name to take -> Error
|
|
31
|
-
|
|
32
|
-
User runs command -> Check if command handler exists -> Check if there is a state with the command name and _main -> Error
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
## API Coverage
|
|
36
|
-
|
|
37
|
-
✔️ Slash Commands
|
|
38
|
-
|
|
39
|
-
✔️ Command Groups
|
|
40
|
-
|
|
41
|
-
✔️ Command Autocomplete
|
|
42
|
-
|
|
43
|
-
✔️ Button Components
|
|
44
|
-
|
|
45
|
-
✔️ Dropdown Components
|
|
46
|
-
|
|
47
|
-
❌ Modals
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
## Naming Convensions
|
|
51
|
-
|
|
52
|
-
Commands may only have one word -> no CamelCase or snake_case needed
|
|
53
|
-
|
|
54
|
-
Components and States must be prefixed with the command they originated from -> A button on the settings command must start with settings_ (=> be placed inside a folder called settings)
|
|
55
|
-
|
|
56
|
-
Components must be named by their desired state and not how to get there. Example: Settings command has a page with general settings (settings_main), which has a button for advanced settings (settings_advanced) which has a button to destroy the world.
|
|
57
|
-
Incorrect naming: settings_advanced_destroy_world
|
|
58
|
-
Correct naming: settings_destroy_world
|
|
59
|
-
|
|
60
|
-
States also follow this principle to not inherit the path into the name, only the destination as shown above.
|
|
61
|
-
|
|
62
|
-
Components that just change state (like "open another page") or have state changing behaviour must be named like states. Example: config_page2, config_name
|
|
63
|
-
Components that have side effects (like changing settings or alike) must be named with a verb. Example: config_name_change, friends_request_send
|
|
64
|
-
For those verbs preferably pick:
|
|
65
|
-
* _change for Select/Dropdowns
|
|
66
|
-
* _toggle for Toggle Buttons
|
|
67
|
-
* _enable/_disable for Single Use Buttons
|
|
68
|
-
|
|
69
|
-
### Examples
|
|
70
|
-
|
|
71
|
-
Component and State names correct and incorrect examples:
|
|
72
|
-
|
|
73
|
-
❌ back
|
|
74
|
-
|
|
75
|
-
❌ back_button
|
|
76
|
-
|
|
77
|
-
❌ state_back
|
|
78
|
-
|
|
79
|
-
❌ settings_back
|
|
80
|
-
|
|
81
|
-
❌ settings_advanced_more
|
|
82
|
-
|
|
83
|
-
❌ command_free_button_one
|
|
84
|
-
|
|
85
|
-
✔️ settings_main
|
|
86
|
-
|
|
87
|
-
✔️ settings_description
|
|
88
|
-
|
|
89
|
-
✔️ free_show_details
|
|
90
|
-
|
|
91
|
-
✔️ settings_more
|
|
92
|
-
|
|
93
|
-
## Best practices
|
|
94
|
-
|
|
95
|
-
While theoretically the entire system could be built on soly using states, it is recomended to use interaction.reply and interaction.edit over states in non-interactive environments to save resources. States have a larger overhead than a simply interaction reply.
|
|
96
|
-
|
|
97
|
-
Cordo is best when it's used stateless. Try to reduce interactive responses to a minimum and always put as much information as possible in the custom ids. This allows for easy scaling as well as a great user experience. It might take some time to get used to but once you understand how to build on this, cordo naturally organizes your code.
|
|
1
|
+
# Cordo
|
|
2
|
+
|
|
3
|
+
Cordo is a custom api wrapper built for interactions first. It functions as an addon on top of discord.js. Full documentation is yet to be written
|
|
4
|
+
|
|
5
|
+
Originally built for the FreeStuff Bot, this codebase could find various usecases so we decided to outsource it. Here's an [Example bot](https://github.com/Maanex/cordo-example-bot) written with it.
|
|
6
|
+
|
|
7
|
+
Or if you prefer real-life examples check out [FreeStuff Bot](https://github.com/FreeStuffBot/discord/tree/master/src/bot) or [Tudebot](https://github.com/Maanex/tudebot4/tree/master/src/cordo).
|
|
8
|
+
|
|
9
|
+
Use `npm i cordo` or `yarn add cordo` to install. Types are included.
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
## How it works (aka quick docs / tutorial)
|
|
13
|
+
|
|
14
|
+
### Commands
|
|
15
|
+
|
|
16
|
+
Go in bot/commands. They export a handler function as default which gets called when the command gets run.
|
|
17
|
+
|
|
18
|
+
### Components
|
|
19
|
+
|
|
20
|
+
Go in bot/components. They too export a handler function as default which gets called when the component gets interacted with (button press or dropdown selection).
|
|
21
|
+
You can create folders to build hierarchy. Each folder prefixes the resulting component id with the foldername and a _
|
|
22
|
+
For instance the handler in `components/foo/bar/test.ts` gets triggered for a component with the custom_id of `foo_bar_test`
|
|
23
|
+
|
|
24
|
+
### States
|
|
25
|
+
|
|
26
|
+
States are an extra layer to the Commands and Components that let you define command pages. Instead of editing or sending a response to a Command or Component Interaction, you can just ask it to take form of a state and Cordo will do the rest.
|
|
27
|
+
|
|
28
|
+
## Interaction flow
|
|
29
|
+
|
|
30
|
+
User presses button -> Check if this interaction has any overrides on timeout -> Check if there are global Component handlers -> Check if there is a state with the same name to take -> Error
|
|
31
|
+
|
|
32
|
+
User runs command -> Check if command handler exists -> Check if there is a state with the command name and _main -> Error
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
## API Coverage
|
|
36
|
+
|
|
37
|
+
✔️ Slash Commands
|
|
38
|
+
|
|
39
|
+
✔️ Command Groups
|
|
40
|
+
|
|
41
|
+
✔️ Command Autocomplete
|
|
42
|
+
|
|
43
|
+
✔️ Button Components
|
|
44
|
+
|
|
45
|
+
✔️ Dropdown Components
|
|
46
|
+
|
|
47
|
+
❌ Modals
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
## Naming Convensions
|
|
51
|
+
|
|
52
|
+
Commands may only have one word -> no CamelCase or snake_case needed
|
|
53
|
+
|
|
54
|
+
Components and States must be prefixed with the command they originated from -> A button on the settings command must start with settings_ (=> be placed inside a folder called settings)
|
|
55
|
+
|
|
56
|
+
Components must be named by their desired state and not how to get there. Example: Settings command has a page with general settings (settings_main), which has a button for advanced settings (settings_advanced) which has a button to destroy the world.
|
|
57
|
+
Incorrect naming: settings_advanced_destroy_world
|
|
58
|
+
Correct naming: settings_destroy_world
|
|
59
|
+
|
|
60
|
+
States also follow this principle to not inherit the path into the name, only the destination as shown above.
|
|
61
|
+
|
|
62
|
+
Components that just change state (like "open another page") or have state changing behaviour must be named like states. Example: config_page2, config_name
|
|
63
|
+
Components that have side effects (like changing settings or alike) must be named with a verb. Example: config_name_change, friends_request_send
|
|
64
|
+
For those verbs preferably pick:
|
|
65
|
+
* _change for Select/Dropdowns
|
|
66
|
+
* _toggle for Toggle Buttons
|
|
67
|
+
* _enable/_disable for Single Use Buttons
|
|
68
|
+
|
|
69
|
+
### Examples
|
|
70
|
+
|
|
71
|
+
Component and State names correct and incorrect examples:
|
|
72
|
+
|
|
73
|
+
❌ back
|
|
74
|
+
|
|
75
|
+
❌ back_button
|
|
76
|
+
|
|
77
|
+
❌ state_back
|
|
78
|
+
|
|
79
|
+
❌ settings_back
|
|
80
|
+
|
|
81
|
+
❌ settings_advanced_more
|
|
82
|
+
|
|
83
|
+
❌ command_free_button_one
|
|
84
|
+
|
|
85
|
+
✔️ settings_main
|
|
86
|
+
|
|
87
|
+
✔️ settings_description
|
|
88
|
+
|
|
89
|
+
✔️ free_show_details
|
|
90
|
+
|
|
91
|
+
✔️ settings_more
|
|
92
|
+
|
|
93
|
+
## Best practices
|
|
94
|
+
|
|
95
|
+
While theoretically the entire system could be built on soly using states, it is recomended to use interaction.reply and interaction.edit over states in non-interactive environments to save resources. States have a larger overhead than a simply interaction reply.
|
|
96
|
+
|
|
97
|
+
Cordo is best when it's used stateless. Try to reduce interactive responses to a minimum and always put as much information as possible in the custom ids. This allows for easy scaling as well as a great user experience. It might take some time to get used to but once you understand how to build on this, cordo naturally organizes your code.
|
package/dist/api.d.ts
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { InteractionApplicationCommandCallbackData, InteractionCallbackFollowup } from './types/custom';
|
|
2
|
-
import { GenericInteraction } from './types/base';
|
|
3
|
-
import { InteractionCallbackType, InteractionComponentFlag } from './types/const';
|
|
4
|
-
import { InteractionApplicationCommandAutocompleteCallbackData, InteractionDefferedCallbackData, InteractionOpenModalData } from './index';
|
|
5
|
-
export default class CordoAPI {
|
|
6
|
-
static interactionCallback(i: GenericInteraction, type: InteractionCallbackType.PONG): Promise<InteractionCallbackFollowup>;
|
|
7
|
-
static interactionCallback(i: GenericInteraction, type: InteractionCallbackType.CHANNEL_MESSAGE_WITH_SOURCE, data: InteractionApplicationCommandCallbackData, contextId?: string, useRaw?: boolean): Promise<InteractionCallbackFollowup>;
|
|
8
|
-
static interactionCallback(i: GenericInteraction, type: InteractionCallbackType.DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE, data?: InteractionDefferedCallbackData): Promise<InteractionCallbackFollowup>;
|
|
9
|
-
static interactionCallback(i: GenericInteraction, type: InteractionCallbackType.DEFERRED_UPDATE_MESSAGE, data?: InteractionDefferedCallbackData): Promise<InteractionCallbackFollowup>;
|
|
10
|
-
static interactionCallback(i: GenericInteraction, type: InteractionCallbackType.UPDATE_MESSAGE, data: InteractionApplicationCommandCallbackData, contextId?: string, useRaw?: boolean): Promise<InteractionCallbackFollowup>;
|
|
11
|
-
static interactionCallback(i: GenericInteraction, type: InteractionCallbackType.APPLICATION_COMMAND_AUTOCOMPLETE_RESULT, data: InteractionApplicationCommandAutocompleteCallbackData, contextId?: string, useRaw?: boolean): Promise<InteractionCallbackFollowup>;
|
|
12
|
-
static interactionCallback(i: GenericInteraction, type: InteractionCallbackType.MODAL, data: InteractionOpenModalData, contextId?: string, useRaw?: boolean): Promise<InteractionCallbackFollowup>;
|
|
13
|
-
private static handleCallbackResponse;
|
|
14
|
-
/**
|
|
15
|
-
* Transforms the shorthand way of writing into proper discord api compatible objects
|
|
16
|
-
*/
|
|
17
|
-
static normaliseData(data: InteractionApplicationCommandCallbackData, i?: GenericInteraction, contextId?: string, type?: InteractionCallbackType): void;
|
|
18
|
-
private static normalizeFindAndResolveSmartEmbed;
|
|
19
|
-
private static normalizeApplyFlags;
|
|
20
|
-
static compileCustomId(customId: string, flags?: InteractionComponentFlag[], contextId?: string): string;
|
|
21
|
-
static parseCustomId(rawId: string): {
|
|
22
|
-
contextId: any;
|
|
23
|
-
_reserved: any;
|
|
24
|
-
customId: any;
|
|
25
|
-
flagsRaw: any;
|
|
26
|
-
};
|
|
27
|
-
}
|
|
1
|
+
import { InteractionApplicationCommandCallbackData, InteractionCallbackFollowup } from './types/custom';
|
|
2
|
+
import { GenericInteraction } from './types/base';
|
|
3
|
+
import { InteractionCallbackType, InteractionComponentFlag } from './types/const';
|
|
4
|
+
import { InteractionApplicationCommandAutocompleteCallbackData, InteractionDefferedCallbackData, InteractionOpenModalData } from './index';
|
|
5
|
+
export default class CordoAPI {
|
|
6
|
+
static interactionCallback(i: GenericInteraction, type: InteractionCallbackType.PONG): Promise<InteractionCallbackFollowup>;
|
|
7
|
+
static interactionCallback(i: GenericInteraction, type: InteractionCallbackType.CHANNEL_MESSAGE_WITH_SOURCE, data: InteractionApplicationCommandCallbackData, contextId?: string, useRaw?: boolean): Promise<InteractionCallbackFollowup>;
|
|
8
|
+
static interactionCallback(i: GenericInteraction, type: InteractionCallbackType.DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE, data?: InteractionDefferedCallbackData): Promise<InteractionCallbackFollowup>;
|
|
9
|
+
static interactionCallback(i: GenericInteraction, type: InteractionCallbackType.DEFERRED_UPDATE_MESSAGE, data?: InteractionDefferedCallbackData): Promise<InteractionCallbackFollowup>;
|
|
10
|
+
static interactionCallback(i: GenericInteraction, type: InteractionCallbackType.UPDATE_MESSAGE, data: InteractionApplicationCommandCallbackData, contextId?: string, useRaw?: boolean): Promise<InteractionCallbackFollowup>;
|
|
11
|
+
static interactionCallback(i: GenericInteraction, type: InteractionCallbackType.APPLICATION_COMMAND_AUTOCOMPLETE_RESULT, data: InteractionApplicationCommandAutocompleteCallbackData, contextId?: string, useRaw?: boolean): Promise<InteractionCallbackFollowup>;
|
|
12
|
+
static interactionCallback(i: GenericInteraction, type: InteractionCallbackType.MODAL, data: InteractionOpenModalData, contextId?: string, useRaw?: boolean): Promise<InteractionCallbackFollowup>;
|
|
13
|
+
private static handleCallbackResponse;
|
|
14
|
+
/**
|
|
15
|
+
* Transforms the shorthand way of writing into proper discord api compatible objects
|
|
16
|
+
*/
|
|
17
|
+
static normaliseData(data: InteractionApplicationCommandCallbackData, i?: GenericInteraction, contextId?: string, type?: InteractionCallbackType): void;
|
|
18
|
+
private static normalizeFindAndResolveSmartEmbed;
|
|
19
|
+
private static normalizeApplyFlags;
|
|
20
|
+
static compileCustomId(customId: string, flags?: InteractionComponentFlag[], contextId?: string): string;
|
|
21
|
+
static parseCustomId(rawId: string): {
|
|
22
|
+
contextId: any;
|
|
23
|
+
_reserved: any;
|
|
24
|
+
customId: any;
|
|
25
|
+
flagsRaw: any;
|
|
26
|
+
};
|
|
27
|
+
}
|