@open-discord-bots/framework 0.0.1 → 0.0.2
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/LICENSE.md +713 -0
- package/README.md +104 -0
- package/dist/api/api.d.ts +26 -0
- package/dist/api/api.js +44 -0
- package/dist/api/main.d.ts +133 -0
- package/dist/api/main.js +87 -0
- package/dist/api/modules/action.d.ts +34 -0
- package/dist/api/modules/action.js +58 -0
- package/dist/api/modules/base.d.ts +329 -0
- package/dist/api/modules/base.js +804 -0
- package/dist/api/modules/builder.d.ts +647 -0
- package/dist/api/modules/builder.js +1441 -0
- package/dist/api/modules/checker.d.ts +648 -0
- package/dist/api/modules/checker.js +1324 -0
- package/dist/api/modules/client.d.ts +768 -0
- package/dist/api/modules/client.js +1859 -0
- package/dist/api/modules/code.d.ts +33 -0
- package/dist/api/modules/code.js +57 -0
- package/dist/api/modules/config.d.ts +70 -0
- package/dist/api/modules/config.js +206 -0
- package/dist/api/modules/console.d.ts +305 -0
- package/dist/api/modules/console.js +598 -0
- package/dist/api/modules/cooldown.d.ts +138 -0
- package/dist/api/modules/cooldown.js +359 -0
- package/dist/api/modules/database.d.ts +135 -0
- package/dist/api/modules/database.js +271 -0
- package/dist/api/modules/event.d.ts +43 -0
- package/dist/api/modules/event.js +100 -0
- package/dist/api/modules/flag.d.ts +40 -0
- package/dist/api/modules/flag.js +72 -0
- package/dist/api/modules/fuse.d.ts +218 -0
- package/dist/api/modules/fuse.js +123 -0
- package/dist/api/modules/helpmenu.d.ts +106 -0
- package/dist/api/modules/helpmenu.js +167 -0
- package/dist/api/modules/language.d.ts +85 -0
- package/dist/api/modules/language.js +195 -0
- package/dist/api/modules/permission.d.ts +121 -0
- package/dist/api/modules/permission.js +314 -0
- package/dist/api/modules/plugin.d.ts +128 -0
- package/dist/api/modules/plugin.js +168 -0
- package/dist/api/modules/post.d.ts +44 -0
- package/dist/api/modules/post.js +92 -0
- package/dist/api/modules/progressbar.d.ts +108 -0
- package/dist/api/modules/progressbar.js +233 -0
- package/dist/api/modules/responder.d.ts +506 -0
- package/dist/api/modules/responder.js +1468 -0
- package/dist/api/modules/session.d.ts +58 -0
- package/dist/api/modules/session.js +171 -0
- package/dist/api/modules/startscreen.d.ts +165 -0
- package/dist/api/modules/startscreen.js +293 -0
- package/dist/api/modules/stat.d.ts +142 -0
- package/dist/api/modules/stat.js +293 -0
- package/dist/api/modules/verifybar.d.ts +54 -0
- package/dist/api/modules/verifybar.js +60 -0
- package/dist/api/modules/worker.d.ts +41 -0
- package/dist/api/modules/worker.js +93 -0
- package/dist/api/utils.d.ts +61 -0
- package/dist/api/utils.js +254 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.js +40 -0
- package/dist/startup/dump.d.ts +14 -0
- package/dist/startup/dump.js +79 -0
- package/dist/startup/errorHandling.d.ts +2 -0
- package/dist/startup/errorHandling.js +43 -0
- package/dist/startup/pluginLauncher.d.ts +2 -0
- package/dist/startup/pluginLauncher.js +202 -0
- package/package.json +9 -3
- package/src/api/api.ts +29 -0
- package/src/api/main.ts +189 -0
- package/src/api/modules/action.ts +58 -0
- package/src/api/modules/base.ts +811 -0
- package/src/api/modules/builder.ts +1554 -0
- package/src/api/modules/checker.ts +1549 -0
- package/src/api/modules/client.ts +2247 -0
- package/src/api/modules/code.ts +58 -0
- package/src/api/modules/config.ts +159 -0
- package/src/api/modules/console.ts +665 -0
- package/src/api/modules/cooldown.ts +348 -0
- package/src/api/modules/database.ts +278 -0
- package/src/api/modules/event.ts +99 -0
- package/src/api/modules/flag.ts +73 -0
- package/src/api/modules/fuse.ts +348 -0
- package/src/api/modules/helpmenu.ts +216 -0
- package/src/api/modules/language.ts +201 -0
- package/src/api/modules/permission.ts +340 -0
- package/src/api/modules/plugin.ts +242 -0
- package/src/api/modules/post.ts +90 -0
- package/src/api/modules/progressbar.ts +232 -0
- package/src/api/modules/responder.ts +1420 -0
- package/src/api/modules/session.ts +155 -0
- package/src/api/modules/startscreen.ts +320 -0
- package/src/api/modules/stat.ts +313 -0
- package/src/api/modules/verifybar.ts +61 -0
- package/src/api/modules/worker.ts +93 -0
- package/src/api/utils.ts +206 -0
- package/src/cli/cli.ts +151 -0
- package/src/cli/editConfig.ts +943 -0
- package/src/index.ts +6 -1
- package/src/startup/compilation.ts +186 -0
- package/src/startup/dump.ts +45 -0
- package/src/startup/errorHandling.ts +38 -0
- package/src/startup/pluginLauncher.ts +261 -0
- package/LICENSE +0 -21
|
@@ -0,0 +1,506 @@
|
|
|
1
|
+
import { ODManager, ODValidId, ODManagerData } from "./base";
|
|
2
|
+
import * as discord from "discord.js";
|
|
3
|
+
import { ODWorkerManager, ODWorkerCallback } from "./worker";
|
|
4
|
+
import { ODDebugger } from "./console";
|
|
5
|
+
import { ODClientManager, ODContextMenu, ODSlashCommand, ODTextCommand, ODTextCommandInteractionOption } from "./client";
|
|
6
|
+
import { ODDropdownData, ODMessageBuildResult, ODMessageBuildSentResult, ODModalBuildResult } from "./builder";
|
|
7
|
+
/**## ODResponderImplementation `class`
|
|
8
|
+
* This is an Open Discord responder implementation.
|
|
9
|
+
*
|
|
10
|
+
* It is a basic implementation of the `ODWorkerManager` used by all `ODResponder` classes.
|
|
11
|
+
*
|
|
12
|
+
* This class can't be used stand-alone & needs to be extended from!
|
|
13
|
+
*/
|
|
14
|
+
export declare class ODResponderImplementation<Instance, Source extends string, Params> extends ODManagerData {
|
|
15
|
+
/**The manager that has all workers of this implementation */
|
|
16
|
+
workers: ODWorkerManager<Instance, Source, Params>;
|
|
17
|
+
/**The `commandName` or `customId` needs to match this string or regex for this responder to be executed. */
|
|
18
|
+
match: string | RegExp;
|
|
19
|
+
constructor(id: ODValidId, match: string | RegExp, callback?: ODWorkerCallback<Instance, Source, Params>, priority?: number, callbackId?: ODValidId);
|
|
20
|
+
/**Execute all workers & return the result. */
|
|
21
|
+
respond(instance: Instance, source: Source, params: Params): Promise<void>;
|
|
22
|
+
}
|
|
23
|
+
/**## ODResponderTimeoutErrorCallback `type`
|
|
24
|
+
* This is the callback for the responder timeout function. It will be executed when something went wrong or the action takes too much time.
|
|
25
|
+
*/
|
|
26
|
+
export type ODResponderTimeoutErrorCallback<Instance, Source extends "slash" | "text" | "button" | "dropdown" | "modal" | "other" | "context-menu" | "autocomplete"> = (instance: Instance, source: Source) => void | Promise<void>;
|
|
27
|
+
/**## ODResponderManager `class`
|
|
28
|
+
* This is an Open Discord responder manager.
|
|
29
|
+
*
|
|
30
|
+
* It contains all Open Discord responders. Responders can respond to an interaction, button, dropdown, modal or command.
|
|
31
|
+
*
|
|
32
|
+
* Using the Open Discord responder system has a few advantages compared to vanilla discord.js:
|
|
33
|
+
* - plugins can extend/edit replies
|
|
34
|
+
* - automatically reply on error
|
|
35
|
+
* - independent workers (with priority)
|
|
36
|
+
* - fail-safe design using try-catch
|
|
37
|
+
* - write code once => reply to both slash & text commands at the same time!
|
|
38
|
+
* - know where the request came from & parse options/subcommands & without errors!
|
|
39
|
+
* - And so much more!
|
|
40
|
+
*/
|
|
41
|
+
export declare class ODResponderManager {
|
|
42
|
+
/**A manager for all (text & slash) command responders. */
|
|
43
|
+
commands: ODCommandResponderManager;
|
|
44
|
+
/**A manager for all button responders. */
|
|
45
|
+
buttons: ODButtonResponderManager;
|
|
46
|
+
/**A manager for all dropdown/select menu responders. */
|
|
47
|
+
dropdowns: ODDropdownResponderManager;
|
|
48
|
+
/**A manager for all modal responders. */
|
|
49
|
+
modals: ODModalResponderManager;
|
|
50
|
+
/**A manager for all context menu responders. */
|
|
51
|
+
contextMenus: ODContextMenuResponderManager;
|
|
52
|
+
/**A manager for all autocomplete responders. */
|
|
53
|
+
autocomplete: ODAutocompleteResponderManager;
|
|
54
|
+
constructor(debug: ODDebugger, client: ODClientManager);
|
|
55
|
+
}
|
|
56
|
+
/**## ODCommandResponderManager `class`
|
|
57
|
+
* This is an Open Discord command responder manager.
|
|
58
|
+
*
|
|
59
|
+
* It contains all Open Discord command responders. These can respond to text & slash commands.
|
|
60
|
+
*
|
|
61
|
+
* Using the Open Discord responder system has a few advantages compared to vanilla discord.js:
|
|
62
|
+
* - plugins can extend/edit replies
|
|
63
|
+
* - automatically reply on error
|
|
64
|
+
* - independent workers (with priority)
|
|
65
|
+
* - fail-safe design using try-catch
|
|
66
|
+
* - write code once => reply to both slash & text commands at the same time!
|
|
67
|
+
* - know where the request came from & parse options/subcommands & without errors!
|
|
68
|
+
* - And so much more!
|
|
69
|
+
*/
|
|
70
|
+
export declare class ODCommandResponderManager extends ODManager<ODCommandResponder<"slash" | "text", any>> {
|
|
71
|
+
#private;
|
|
72
|
+
constructor(debug: ODDebugger, debugname: string, client: ODClientManager);
|
|
73
|
+
/**Set the message to send when the response times out! */
|
|
74
|
+
setTimeoutErrorCallback(callback: ODResponderTimeoutErrorCallback<ODCommandResponderInstance, "slash" | "text"> | null, ms: number | null): void;
|
|
75
|
+
add(data: ODCommandResponder<"slash" | "text", any>, overwrite?: boolean): boolean;
|
|
76
|
+
}
|
|
77
|
+
/**## ODCommandResponderInstanceOptions `class`
|
|
78
|
+
* This is an Open Discord command responder instance options manager.
|
|
79
|
+
*
|
|
80
|
+
* This class will manage all options & subcommands from slash & text commands.
|
|
81
|
+
*/
|
|
82
|
+
export declare class ODCommandResponderInstanceOptions {
|
|
83
|
+
#private;
|
|
84
|
+
constructor(interaction: discord.ChatInputCommandInteraction | discord.Message, cmd: ODSlashCommand | ODTextCommand, options?: ODTextCommandInteractionOption[]);
|
|
85
|
+
/**Get a string option. */
|
|
86
|
+
getString(name: string, required: true): string;
|
|
87
|
+
getString(name: string, required: false): string | null;
|
|
88
|
+
/**Get a boolean option. */
|
|
89
|
+
getBoolean(name: string, required: true): boolean;
|
|
90
|
+
getBoolean(name: string, required: false): boolean | null;
|
|
91
|
+
/**Get a number option. */
|
|
92
|
+
getNumber(name: string, required: true): number;
|
|
93
|
+
getNumber(name: string, required: false): number | null;
|
|
94
|
+
/**Get a channel option. */
|
|
95
|
+
getChannel(name: string, required: true): discord.TextChannel | discord.VoiceChannel | discord.StageChannel | discord.NewsChannel | discord.MediaChannel | discord.ForumChannel | discord.CategoryChannel;
|
|
96
|
+
getChannel(name: string, required: false): discord.TextChannel | discord.VoiceChannel | discord.StageChannel | discord.NewsChannel | discord.MediaChannel | discord.ForumChannel | discord.CategoryChannel | null;
|
|
97
|
+
/**Get a role option. */
|
|
98
|
+
getRole(name: string, required: true): discord.Role;
|
|
99
|
+
getRole(name: string, required: false): discord.Role | null;
|
|
100
|
+
/**Get a user option. */
|
|
101
|
+
getUser(name: string, required: true): discord.User;
|
|
102
|
+
getUser(name: string, required: false): discord.User | null;
|
|
103
|
+
/**Get a guild member option. */
|
|
104
|
+
getGuildMember(name: string, required: true): discord.GuildMember;
|
|
105
|
+
getGuildMember(name: string, required: false): discord.GuildMember | null;
|
|
106
|
+
/**Get a mentionable option. */
|
|
107
|
+
getMentionable(name: string, required: true): discord.User | discord.GuildMember | discord.Role;
|
|
108
|
+
getMentionable(name: string, required: false): discord.User | discord.GuildMember | discord.Role | null;
|
|
109
|
+
/**Get a subgroup. */
|
|
110
|
+
getSubGroup(): string | null;
|
|
111
|
+
/**Get a subcommand. */
|
|
112
|
+
getSubCommand(): string | null;
|
|
113
|
+
}
|
|
114
|
+
/**## ODCommandResponderInstance `class`
|
|
115
|
+
* This is an Open Discord command responder instance.
|
|
116
|
+
*
|
|
117
|
+
* An instance is an active slash interaction or used text command. You can reply to the command using `reply()` for both slash & text commands.
|
|
118
|
+
*/
|
|
119
|
+
export declare class ODCommandResponderInstance {
|
|
120
|
+
/**The interaction which is the source of this instance. */
|
|
121
|
+
interaction: discord.ChatInputCommandInteraction | discord.Message;
|
|
122
|
+
/**The command wich is the source of this instance. */
|
|
123
|
+
cmd: ODSlashCommand | ODTextCommand;
|
|
124
|
+
/**The type/source of instance. (from text or slash command) */
|
|
125
|
+
type: "message" | "interaction";
|
|
126
|
+
/**Did a worker already reply to this instance/interaction? */
|
|
127
|
+
didReply: boolean;
|
|
128
|
+
/**The manager for all options of this command. */
|
|
129
|
+
options: ODCommandResponderInstanceOptions;
|
|
130
|
+
/**The user who triggered this command. */
|
|
131
|
+
user: discord.User;
|
|
132
|
+
/**The guild member who triggered this command. */
|
|
133
|
+
member: discord.GuildMember | null;
|
|
134
|
+
/**The guild where this command was triggered. */
|
|
135
|
+
guild: discord.Guild | null;
|
|
136
|
+
/**The channel where this command was triggered. */
|
|
137
|
+
channel: discord.TextBasedChannel;
|
|
138
|
+
constructor(interaction: discord.ChatInputCommandInteraction | discord.Message, cmd: ODSlashCommand | ODTextCommand, errorCallback: ODResponderTimeoutErrorCallback<ODCommandResponderInstance, "slash" | "text"> | null, timeoutMs: number | null, options?: ODTextCommandInteractionOption[]);
|
|
139
|
+
/**Reply to this command. */
|
|
140
|
+
reply(msg: ODMessageBuildResult): Promise<ODMessageBuildSentResult<boolean>>;
|
|
141
|
+
/**Defer this command. */
|
|
142
|
+
defer(ephemeral: boolean): Promise<boolean>;
|
|
143
|
+
/**Show a modal as reply to this command. */
|
|
144
|
+
modal(modal: ODModalBuildResult): Promise<boolean>;
|
|
145
|
+
}
|
|
146
|
+
/**## ODCommandResponder `class`
|
|
147
|
+
* This is an Open Discord command responder.
|
|
148
|
+
*
|
|
149
|
+
* This class manages all workers which are executed when the related command is triggered.
|
|
150
|
+
*/
|
|
151
|
+
export declare class ODCommandResponder<Source extends "slash" | "text", Params> extends ODResponderImplementation<ODCommandResponderInstance, Source, Params> {
|
|
152
|
+
/**The prefix of the text command needs to match this */
|
|
153
|
+
prefix: string;
|
|
154
|
+
constructor(id: ODValidId, prefix: string, match: string | RegExp, callback?: ODWorkerCallback<ODCommandResponderInstance, Source, Params>, priority?: number, callbackId?: ODValidId);
|
|
155
|
+
/**Respond to this command */
|
|
156
|
+
respond(instance: ODCommandResponderInstance, source: Source, params: Params): Promise<void>;
|
|
157
|
+
}
|
|
158
|
+
/**## ODButtonResponderManager `class`
|
|
159
|
+
* This is an Open Discord button responder manager.
|
|
160
|
+
*
|
|
161
|
+
* It contains all Open Discord button responders. These can respond to button interactions.
|
|
162
|
+
*
|
|
163
|
+
* Using the Open Discord responder system has a few advantages compared to vanilla discord.js:
|
|
164
|
+
* - plugins can extend/edit replies
|
|
165
|
+
* - automatically reply on error
|
|
166
|
+
* - independent workers (with priority)
|
|
167
|
+
* - fail-safe design using try-catch
|
|
168
|
+
* - know where the request came from!
|
|
169
|
+
* - And so much more!
|
|
170
|
+
*/
|
|
171
|
+
export declare class ODButtonResponderManager extends ODManager<ODButtonResponder<"button", any>> {
|
|
172
|
+
#private;
|
|
173
|
+
constructor(debug: ODDebugger, debugname: string, client: ODClientManager);
|
|
174
|
+
/**Set the message to send when the response times out! */
|
|
175
|
+
setTimeoutErrorCallback(callback: ODResponderTimeoutErrorCallback<ODButtonResponderInstance, "button"> | null, ms: number | null): void;
|
|
176
|
+
add(data: ODButtonResponder<"button", any>, overwrite?: boolean): boolean;
|
|
177
|
+
}
|
|
178
|
+
/**## ODButtonResponderInstance `class`
|
|
179
|
+
* This is an Open Discord button responder instance.
|
|
180
|
+
*
|
|
181
|
+
* An instance is an active button interaction. You can reply to the button using `reply()`.
|
|
182
|
+
*/
|
|
183
|
+
export declare class ODButtonResponderInstance {
|
|
184
|
+
/**The interaction which is the source of this instance. */
|
|
185
|
+
interaction: discord.ButtonInteraction;
|
|
186
|
+
/**Did a worker already reply to this instance/interaction? */
|
|
187
|
+
didReply: boolean;
|
|
188
|
+
/**The user who triggered this button. */
|
|
189
|
+
user: discord.User;
|
|
190
|
+
/**The guild member who triggered this button. */
|
|
191
|
+
member: discord.GuildMember | null;
|
|
192
|
+
/**The guild where this button was triggered. */
|
|
193
|
+
guild: discord.Guild | null;
|
|
194
|
+
/**The channel where this button was triggered. */
|
|
195
|
+
channel: discord.TextBasedChannel;
|
|
196
|
+
/**The message this button originates from. */
|
|
197
|
+
message: discord.Message;
|
|
198
|
+
constructor(interaction: discord.ButtonInteraction, errorCallback: ODResponderTimeoutErrorCallback<ODButtonResponderInstance, "button"> | null, timeoutMs: number | null);
|
|
199
|
+
/**Reply to this button. */
|
|
200
|
+
reply(msg: ODMessageBuildResult): Promise<ODMessageBuildSentResult<boolean>>;
|
|
201
|
+
/**Update the message of this button. */
|
|
202
|
+
update(msg: ODMessageBuildResult): Promise<ODMessageBuildSentResult<boolean>>;
|
|
203
|
+
/**Defer this button. */
|
|
204
|
+
defer(type: "reply" | "update", ephemeral: boolean): Promise<boolean>;
|
|
205
|
+
/**Show a modal as reply to this button. */
|
|
206
|
+
modal(modal: ODModalBuildResult): Promise<boolean>;
|
|
207
|
+
/**Get a component from the original message of this button. */
|
|
208
|
+
getMessageComponent(type: "button", id: string | RegExp): discord.ButtonComponent | null;
|
|
209
|
+
getMessageComponent(type: "string-dropdown", id: string | RegExp): discord.StringSelectMenuComponent | null;
|
|
210
|
+
getMessageComponent(type: "user-dropdown", id: string | RegExp): discord.UserSelectMenuComponent | null;
|
|
211
|
+
getMessageComponent(type: "channel-dropdown", id: string | RegExp): discord.ChannelSelectMenuComponent | null;
|
|
212
|
+
getMessageComponent(type: "role-dropdown", id: string | RegExp): discord.RoleSelectMenuComponent | null;
|
|
213
|
+
getMessageComponent(type: "mentionable-dropdown", id: string | RegExp): discord.MentionableSelectMenuComponent | null;
|
|
214
|
+
/**Get the first embed of the original message if it exists. */
|
|
215
|
+
getMessageEmbed(): discord.Embed | null;
|
|
216
|
+
}
|
|
217
|
+
/**## ODButtonResponder `class`
|
|
218
|
+
* This is an Open Discord button responder.
|
|
219
|
+
*
|
|
220
|
+
* This class manages all workers which are executed when the related button is triggered.
|
|
221
|
+
*/
|
|
222
|
+
export declare class ODButtonResponder<Source extends string, Params> extends ODResponderImplementation<ODButtonResponderInstance, Source, Params> {
|
|
223
|
+
/**Respond to this button */
|
|
224
|
+
respond(instance: ODButtonResponderInstance, source: Source, params: Params): Promise<void>;
|
|
225
|
+
}
|
|
226
|
+
/**## ODDropdownResponderManager `class`
|
|
227
|
+
* This is an Open Discord dropdown responder manager.
|
|
228
|
+
*
|
|
229
|
+
* It contains all Open Discord dropdown responders. These can respond to dropdown interactions.
|
|
230
|
+
*
|
|
231
|
+
* Using the Open Discord responder system has a few advantages compared to vanilla discord.js:
|
|
232
|
+
* - plugins can extend/edit replies
|
|
233
|
+
* - automatically reply on error
|
|
234
|
+
* - independent workers (with priority)
|
|
235
|
+
* - fail-safe design using try-catch
|
|
236
|
+
* - know where the request came from!
|
|
237
|
+
* - And so much more!
|
|
238
|
+
*/
|
|
239
|
+
export declare class ODDropdownResponderManager extends ODManager<ODDropdownResponder<"dropdown", any>> {
|
|
240
|
+
#private;
|
|
241
|
+
constructor(debug: ODDebugger, debugname: string, client: ODClientManager);
|
|
242
|
+
/**Set the message to send when the response times out! */
|
|
243
|
+
setTimeoutErrorCallback(callback: ODResponderTimeoutErrorCallback<ODDropdownResponderInstance, "dropdown"> | null, ms: number | null): void;
|
|
244
|
+
add(data: ODDropdownResponder<"dropdown", any>, overwrite?: boolean): boolean;
|
|
245
|
+
}
|
|
246
|
+
/**## ODDropdownResponderInstanceValues `class`
|
|
247
|
+
* This is an Open Discord dropdown responder instance values manager.
|
|
248
|
+
*
|
|
249
|
+
* This class will manage all values from the dropdowns & select menus.
|
|
250
|
+
*/
|
|
251
|
+
export declare class ODDropdownResponderInstanceValues {
|
|
252
|
+
#private;
|
|
253
|
+
constructor(interaction: discord.AnySelectMenuInteraction, type: ODDropdownData["type"]);
|
|
254
|
+
/**Get the selected values. */
|
|
255
|
+
getStringValues(): string[];
|
|
256
|
+
/**Get the selected roles. */
|
|
257
|
+
getRoleValues(): Promise<discord.Role[]>;
|
|
258
|
+
/**Get the selected users. */
|
|
259
|
+
getUserValues(): Promise<discord.User[]>;
|
|
260
|
+
/**Get the selected channels. */
|
|
261
|
+
getChannelValues(): Promise<discord.GuildBasedChannel[]>;
|
|
262
|
+
}
|
|
263
|
+
/**## ODDropdownResponderInstance `class`
|
|
264
|
+
* This is an Open Discord dropdown responder instance.
|
|
265
|
+
*
|
|
266
|
+
* An instance is an active dropdown interaction. You can reply to the dropdown using `reply()`.
|
|
267
|
+
*/
|
|
268
|
+
export declare class ODDropdownResponderInstance {
|
|
269
|
+
/**The interaction which is the source of this instance. */
|
|
270
|
+
interaction: discord.AnySelectMenuInteraction;
|
|
271
|
+
/**Did a worker already reply to this instance/interaction? */
|
|
272
|
+
didReply: boolean;
|
|
273
|
+
/**The dropdown type. */
|
|
274
|
+
type: ODDropdownData["type"];
|
|
275
|
+
/**The manager for all values of this dropdown. */
|
|
276
|
+
values: ODDropdownResponderInstanceValues;
|
|
277
|
+
/**The user who triggered this dropdown. */
|
|
278
|
+
user: discord.User;
|
|
279
|
+
/**The guild member who triggered this dropdown. */
|
|
280
|
+
member: discord.GuildMember | null;
|
|
281
|
+
/**The guild where this dropdown was triggered. */
|
|
282
|
+
guild: discord.Guild | null;
|
|
283
|
+
/**The channel where this dropdown was triggered. */
|
|
284
|
+
channel: discord.TextBasedChannel;
|
|
285
|
+
/**The message this dropdown originates from. */
|
|
286
|
+
message: discord.Message;
|
|
287
|
+
constructor(interaction: discord.AnySelectMenuInteraction, errorCallback: ODResponderTimeoutErrorCallback<ODDropdownResponderInstance, "dropdown"> | null, timeoutMs: number | null);
|
|
288
|
+
/**Reply to this dropdown. */
|
|
289
|
+
reply(msg: ODMessageBuildResult): Promise<ODMessageBuildSentResult<boolean>>;
|
|
290
|
+
/**Update the message of this dropdown. */
|
|
291
|
+
update(msg: ODMessageBuildResult): Promise<ODMessageBuildSentResult<boolean>>;
|
|
292
|
+
/**Defer this dropdown. */
|
|
293
|
+
defer(type: "reply" | "update", ephemeral: boolean): Promise<boolean>;
|
|
294
|
+
/**Show a modal as reply to this dropdown. */
|
|
295
|
+
modal(modal: ODModalBuildResult): Promise<boolean>;
|
|
296
|
+
/**Get a component from the original message of this dropdown. */
|
|
297
|
+
getMessageComponent(type: "button", id: string | RegExp): discord.ButtonComponent | null;
|
|
298
|
+
getMessageComponent(type: "string-dropdown", id: string | RegExp): discord.StringSelectMenuComponent | null;
|
|
299
|
+
getMessageComponent(type: "user-dropdown", id: string | RegExp): discord.UserSelectMenuComponent | null;
|
|
300
|
+
getMessageComponent(type: "channel-dropdown", id: string | RegExp): discord.ChannelSelectMenuComponent | null;
|
|
301
|
+
getMessageComponent(type: "role-dropdown", id: string | RegExp): discord.RoleSelectMenuComponent | null;
|
|
302
|
+
getMessageComponent(type: "mentionable-dropdown", id: string | RegExp): discord.MentionableSelectMenuComponent | null;
|
|
303
|
+
/**Get the first embed of the original message if it exists. */
|
|
304
|
+
getMessageEmbed(): discord.Embed | null;
|
|
305
|
+
}
|
|
306
|
+
/**## ODDropdownResponder `class`
|
|
307
|
+
* This is an Open Discord dropdown responder.
|
|
308
|
+
*
|
|
309
|
+
* This class manages all workers which are executed when the related dropdown is triggered.
|
|
310
|
+
*/
|
|
311
|
+
export declare class ODDropdownResponder<Source extends string, Params> extends ODResponderImplementation<ODDropdownResponderInstance, Source, Params> {
|
|
312
|
+
/**Respond to this dropdown */
|
|
313
|
+
respond(instance: ODDropdownResponderInstance, source: Source, params: Params): Promise<void>;
|
|
314
|
+
}
|
|
315
|
+
/**## ODModalResponderManager `class`
|
|
316
|
+
* This is an Open Discord modal responder manager.
|
|
317
|
+
*
|
|
318
|
+
* It contains all Open Discord modal responders. These can respond to modal interactions.
|
|
319
|
+
*
|
|
320
|
+
* Using the Open Discord responder system has a few advantages compared to vanilla discord.js:
|
|
321
|
+
* - plugins can extend/edit replies
|
|
322
|
+
* - automatically reply on error
|
|
323
|
+
* - independent workers (with priority)
|
|
324
|
+
* - fail-safe design using try-catch
|
|
325
|
+
* - know where the request came from!
|
|
326
|
+
* - And so much more!
|
|
327
|
+
*/
|
|
328
|
+
export declare class ODModalResponderManager extends ODManager<ODModalResponder<"modal", any>> {
|
|
329
|
+
#private;
|
|
330
|
+
constructor(debug: ODDebugger, debugname: string, client: ODClientManager);
|
|
331
|
+
/**Set the message to send when the response times out! */
|
|
332
|
+
setTimeoutErrorCallback(callback: ODResponderTimeoutErrorCallback<ODModalResponderInstance, "modal"> | null, ms: number | null): void;
|
|
333
|
+
add(data: ODModalResponder<"modal", any>, overwrite?: boolean): boolean;
|
|
334
|
+
}
|
|
335
|
+
/**## ODModalResponderInstanceValues `class`
|
|
336
|
+
* This is an Open Discord modal responder instance values manager.
|
|
337
|
+
*
|
|
338
|
+
* This class will manage all fields from the modals.
|
|
339
|
+
*/
|
|
340
|
+
export declare class ODModalResponderInstanceValues {
|
|
341
|
+
#private;
|
|
342
|
+
constructor(interaction: discord.ModalSubmitInteraction);
|
|
343
|
+
/**Get the value of a text field. */
|
|
344
|
+
getTextField(name: string, required: true): string;
|
|
345
|
+
getTextField(name: string, required: false): string | null;
|
|
346
|
+
}
|
|
347
|
+
/**## ODModalResponderInstance `class`
|
|
348
|
+
* This is an Open Discord modal responder instance.
|
|
349
|
+
*
|
|
350
|
+
* An instance is an active modal interaction. You can reply to the modal using `reply()`.
|
|
351
|
+
*/
|
|
352
|
+
export declare class ODModalResponderInstance {
|
|
353
|
+
/**The interaction which is the source of this instance. */
|
|
354
|
+
interaction: discord.ModalSubmitInteraction;
|
|
355
|
+
/**Did a worker already reply to this instance/interaction? */
|
|
356
|
+
didReply: boolean;
|
|
357
|
+
/**The manager for all fields of this modal. */
|
|
358
|
+
values: ODModalResponderInstanceValues;
|
|
359
|
+
/**The user who triggered this modal. */
|
|
360
|
+
user: discord.User;
|
|
361
|
+
/**The guild member who triggered this modal. */
|
|
362
|
+
member: discord.GuildMember | null;
|
|
363
|
+
/**The guild where this modal was triggered. */
|
|
364
|
+
guild: discord.Guild | null;
|
|
365
|
+
/**The channel where this modal was triggered. */
|
|
366
|
+
channel: discord.TextBasedChannel | null;
|
|
367
|
+
constructor(interaction: discord.ModalSubmitInteraction, errorCallback: ODResponderTimeoutErrorCallback<ODModalResponderInstance, "modal"> | null, timeoutMs: number | null);
|
|
368
|
+
/**Reply to this modal. */
|
|
369
|
+
reply(msg: ODMessageBuildResult): Promise<ODMessageBuildSentResult<boolean>>;
|
|
370
|
+
/**Update the message of this modal. */
|
|
371
|
+
update(msg: ODMessageBuildResult): Promise<ODMessageBuildSentResult<boolean>>;
|
|
372
|
+
/**Defer this modal. */
|
|
373
|
+
defer(type: "reply" | "update", ephemeral: boolean): Promise<boolean>;
|
|
374
|
+
}
|
|
375
|
+
/**## ODModalResponder `class`
|
|
376
|
+
* This is an Open Discord modal responder.
|
|
377
|
+
*
|
|
378
|
+
* This class manages all workers which are executed when the related modal is triggered.
|
|
379
|
+
*/
|
|
380
|
+
export declare class ODModalResponder<Source extends string, Params> extends ODResponderImplementation<ODModalResponderInstance, Source, Params> {
|
|
381
|
+
/**Respond to this modal */
|
|
382
|
+
respond(instance: ODModalResponderInstance, source: Source, params: Params): Promise<void>;
|
|
383
|
+
}
|
|
384
|
+
/**## ODContextMenuResponderManager `class`
|
|
385
|
+
* This is an Open Discord context menu responder manager.
|
|
386
|
+
*
|
|
387
|
+
* It contains all Open Discord context menu responders. These can respond to user/message context menu interactions.
|
|
388
|
+
*
|
|
389
|
+
* Using the Open Discord responder system has a few advantages compared to vanilla discord.js:
|
|
390
|
+
* - plugins can extend/edit replies
|
|
391
|
+
* - automatically reply on error
|
|
392
|
+
* - independent workers (with priority)
|
|
393
|
+
* - fail-safe design using try-catch
|
|
394
|
+
* - know where the request came from!
|
|
395
|
+
* - And so much more!
|
|
396
|
+
*/
|
|
397
|
+
export declare class ODContextMenuResponderManager extends ODManager<ODContextMenuResponder<"context-menu", any>> {
|
|
398
|
+
#private;
|
|
399
|
+
constructor(debug: ODDebugger, debugname: string, client: ODClientManager);
|
|
400
|
+
/**Set the message to send when the response times out! */
|
|
401
|
+
setTimeoutErrorCallback(callback: ODResponderTimeoutErrorCallback<ODContextMenuResponderInstance, "context-menu"> | null, ms: number | null): void;
|
|
402
|
+
add(data: ODContextMenuResponder<"context-menu", any>, overwrite?: boolean): boolean;
|
|
403
|
+
}
|
|
404
|
+
/**## ODContextMenuResponderInstance `class`
|
|
405
|
+
* This is an Open Discord context menu responder instance.
|
|
406
|
+
*
|
|
407
|
+
* An instance is an active context menu interaction. You can reply to the context menu using `reply()`.
|
|
408
|
+
*/
|
|
409
|
+
export declare class ODContextMenuResponderInstance {
|
|
410
|
+
/**The interaction which is the source of this instance. */
|
|
411
|
+
interaction: discord.ContextMenuCommandInteraction;
|
|
412
|
+
/**Did a worker already reply to this instance/interaction? */
|
|
413
|
+
didReply: boolean;
|
|
414
|
+
/**The context menu wich is the source of this instance. */
|
|
415
|
+
menu: ODContextMenu;
|
|
416
|
+
/**The user who triggered this context menu. */
|
|
417
|
+
user: discord.User;
|
|
418
|
+
/**The guild member who triggered this context menu. */
|
|
419
|
+
member: discord.GuildMember | null;
|
|
420
|
+
/**The guild where this context menu was triggered. */
|
|
421
|
+
guild: discord.Guild | null;
|
|
422
|
+
/**The channel where this context menu was triggered. */
|
|
423
|
+
channel: discord.TextBasedChannel;
|
|
424
|
+
/**The target of this context menu (user or message). */
|
|
425
|
+
target: discord.Message | discord.User;
|
|
426
|
+
constructor(interaction: discord.ContextMenuCommandInteraction, menu: ODContextMenu, errorCallback: ODResponderTimeoutErrorCallback<ODContextMenuResponderInstance, "context-menu"> | null, timeoutMs: number | null);
|
|
427
|
+
/**Reply to this context menu. */
|
|
428
|
+
reply(msg: ODMessageBuildResult): Promise<ODMessageBuildSentResult<boolean>>;
|
|
429
|
+
/**Update the message of this context menu. */
|
|
430
|
+
update(msg: ODMessageBuildResult): Promise<ODMessageBuildSentResult<boolean>>;
|
|
431
|
+
/**Defer this context menu. */
|
|
432
|
+
defer(type: "reply", ephemeral: boolean): Promise<boolean>;
|
|
433
|
+
/**Show a modal as reply to this context menu. */
|
|
434
|
+
modal(modal: ODModalBuildResult): Promise<boolean>;
|
|
435
|
+
}
|
|
436
|
+
/**## ODContextMenuResponder `class`
|
|
437
|
+
* This is an Open Discord context menu responder.
|
|
438
|
+
*
|
|
439
|
+
* This class manages all workers which are executed when the related context menu is triggered.
|
|
440
|
+
*/
|
|
441
|
+
export declare class ODContextMenuResponder<Source extends string, Params> extends ODResponderImplementation<ODContextMenuResponderInstance, Source, Params> {
|
|
442
|
+
/**Respond to this button */
|
|
443
|
+
respond(instance: ODContextMenuResponderInstance, source: Source, params: Params): Promise<void>;
|
|
444
|
+
}
|
|
445
|
+
/**## ODAutocompleteResponderManager `class`
|
|
446
|
+
* This is an Open Discord autocomplete responder manager.
|
|
447
|
+
*
|
|
448
|
+
* It contains all Open Discord autocomplete responders. These can respond to autocomplete interactions.
|
|
449
|
+
*
|
|
450
|
+
* Using the Open Discord responder system has a few advantages compared to vanilla discord.js:
|
|
451
|
+
* - plugins can extend/edit replies
|
|
452
|
+
* - automatically reply on error
|
|
453
|
+
* - independent workers (with priority)
|
|
454
|
+
* - fail-safe design using try-catch
|
|
455
|
+
* - know where the request came from!
|
|
456
|
+
* - And so much more!
|
|
457
|
+
*/
|
|
458
|
+
export declare class ODAutocompleteResponderManager extends ODManager<ODAutocompleteResponder<"autocomplete", any>> {
|
|
459
|
+
#private;
|
|
460
|
+
constructor(debug: ODDebugger, debugname: string, client: ODClientManager);
|
|
461
|
+
/**Set the message to send when the response times out! */
|
|
462
|
+
setTimeoutErrorCallback(callback: ODResponderTimeoutErrorCallback<ODAutocompleteResponderInstance, "autocomplete"> | null, ms: number | null): void;
|
|
463
|
+
add(data: ODAutocompleteResponder<"autocomplete", any>, overwrite?: boolean): boolean;
|
|
464
|
+
}
|
|
465
|
+
/**## ODAutocompleteResponderInstance `class`
|
|
466
|
+
* This is an Open Discord autocomplete responder instance.
|
|
467
|
+
*
|
|
468
|
+
* An instance is an active autocomplete interaction. You can reply to the autocomplete using `reply()`.
|
|
469
|
+
*/
|
|
470
|
+
export declare class ODAutocompleteResponderInstance {
|
|
471
|
+
/**The interaction which is the source of this instance. */
|
|
472
|
+
interaction: discord.AutocompleteInteraction;
|
|
473
|
+
/**Did a worker already respond to this instance/interaction? */
|
|
474
|
+
didRespond: boolean;
|
|
475
|
+
/**The user who triggered this autocomplete. */
|
|
476
|
+
user: discord.User;
|
|
477
|
+
/**The guild member who triggered this autocomplete. */
|
|
478
|
+
member: discord.GuildMember | null;
|
|
479
|
+
/**The guild where this autocomplete was triggered. */
|
|
480
|
+
guild: discord.Guild | null;
|
|
481
|
+
/**The channel where this autocomplete was triggered. */
|
|
482
|
+
channel: discord.TextBasedChannel;
|
|
483
|
+
/**The target slash command option of this autocomplete. */
|
|
484
|
+
target: discord.AutocompleteFocusedOption;
|
|
485
|
+
constructor(interaction: discord.AutocompleteInteraction, errorCallback: ODResponderTimeoutErrorCallback<ODAutocompleteResponderInstance, "autocomplete"> | null, timeoutMs: number | null);
|
|
486
|
+
/**Reply to this autocomplete. */
|
|
487
|
+
autocomplete(choices: (string | discord.ApplicationCommandOptionChoiceData)[]): Promise<{
|
|
488
|
+
success: boolean;
|
|
489
|
+
}>;
|
|
490
|
+
/**Reply to this autocomplete, but filter choices based on the input of the user. */
|
|
491
|
+
filteredAutocomplete(choices: (string | discord.ApplicationCommandOptionChoiceData)[]): Promise<{
|
|
492
|
+
success: boolean;
|
|
493
|
+
}>;
|
|
494
|
+
}
|
|
495
|
+
/**## ODAutocompleteResponder `class`
|
|
496
|
+
* This is an Open Discord autocomplete responder.
|
|
497
|
+
*
|
|
498
|
+
* This class manages all workers which are executed when the related autocomplete is triggered.
|
|
499
|
+
*/
|
|
500
|
+
export declare class ODAutocompleteResponder<Source extends string, Params> extends ODResponderImplementation<ODAutocompleteResponderInstance, Source, Params> {
|
|
501
|
+
/**The slash command of the autocomplete should match the following regex. */
|
|
502
|
+
cmdMatch: string | RegExp;
|
|
503
|
+
constructor(id: ODValidId, cmdMatch: string | RegExp, match: string | RegExp, callback?: ODWorkerCallback<ODAutocompleteResponderInstance, Source, Params>, priority?: number, callbackId?: ODValidId);
|
|
504
|
+
/**Respond to this autocomplete interaction. */
|
|
505
|
+
respond(instance: ODAutocompleteResponderInstance, source: Source, params: Params): Promise<void>;
|
|
506
|
+
}
|