@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,647 @@
|
|
|
1
|
+
import { ODId, ODValidButtonColor, ODValidId, ODInterfaceWithPartialProperty, ODManagerWithSafety, ODManagerData } from "./base";
|
|
2
|
+
import * as discord from "discord.js";
|
|
3
|
+
import { ODWorkerManager, ODWorkerCallback } from "./worker";
|
|
4
|
+
import { ODDebugger } from "./console";
|
|
5
|
+
/**## ODBuilderImplementation `class`
|
|
6
|
+
* This is an Open Discord builder implementation.
|
|
7
|
+
*
|
|
8
|
+
* It is a basic implementation of the `ODWorkerManager` used by all `ODBuilder` classes.
|
|
9
|
+
*
|
|
10
|
+
* This class can't be used stand-alone & needs to be extended from!
|
|
11
|
+
*/
|
|
12
|
+
export declare class ODBuilderImplementation<Instance, Source extends string, Params, BuildType extends {
|
|
13
|
+
id: ODId;
|
|
14
|
+
}> extends ODManagerData {
|
|
15
|
+
/**The manager that has all workers of this implementation */
|
|
16
|
+
workers: ODWorkerManager<Instance, Source, Params>;
|
|
17
|
+
/**Cache a build or create it every time from scratch when this.build() gets executed. */
|
|
18
|
+
allowCache: boolean;
|
|
19
|
+
/**Did the build already got created/cached? */
|
|
20
|
+
didCache: boolean;
|
|
21
|
+
/**The cache of this build. */
|
|
22
|
+
cache: BuildType | null;
|
|
23
|
+
constructor(id: ODValidId, callback?: ODWorkerCallback<Instance, Source, Params>, priority?: number, callbackId?: ODValidId);
|
|
24
|
+
/**Set if caching is allowed */
|
|
25
|
+
setCacheMode(allowed: boolean): this;
|
|
26
|
+
/**Reset the current cache */
|
|
27
|
+
resetCache(): this;
|
|
28
|
+
/**Execute all workers & return the result. */
|
|
29
|
+
build(source: Source, params: Params): Promise<BuildType>;
|
|
30
|
+
}
|
|
31
|
+
/**## ODBuilderManager `class`
|
|
32
|
+
* This is an Open Discord builder manager.
|
|
33
|
+
*
|
|
34
|
+
* It contains all Open Discord builders. You can find messages, embeds, files & dropdowns, buttons & modals all here!
|
|
35
|
+
*
|
|
36
|
+
* Using the Open Discord builder system has a few advantages compared to vanilla discord.js:
|
|
37
|
+
* - plugins can extend/edit messages
|
|
38
|
+
* - automatically reply on error
|
|
39
|
+
* - independent workers (with priority)
|
|
40
|
+
* - fail-safe design using try-catch
|
|
41
|
+
* - cache frequently used objects
|
|
42
|
+
* - get to know the source of the build request for a specific message, button, etc
|
|
43
|
+
* - And so much more!
|
|
44
|
+
*/
|
|
45
|
+
export declare class ODBuilderManager {
|
|
46
|
+
/**The manager for all button builders */
|
|
47
|
+
buttons: ODButtonManager;
|
|
48
|
+
/**The manager for all dropdown builders */
|
|
49
|
+
dropdowns: ODDropdownManager;
|
|
50
|
+
/**The manager for all file/attachment builders */
|
|
51
|
+
files: ODFileManager;
|
|
52
|
+
/**The manager for all embed builders */
|
|
53
|
+
embeds: ODEmbedManager;
|
|
54
|
+
/**The manager for all message builders */
|
|
55
|
+
messages: ODMessageManager;
|
|
56
|
+
/**The manager for all modal builders */
|
|
57
|
+
modals: ODModalManager;
|
|
58
|
+
constructor(debug: ODDebugger);
|
|
59
|
+
}
|
|
60
|
+
/**## ODComponentBuildResult `interface`
|
|
61
|
+
* This interface contains the result from a built component (button/dropdown). This can be used in the `ODMessage` builder!
|
|
62
|
+
*/
|
|
63
|
+
export interface ODComponentBuildResult {
|
|
64
|
+
/**The id of this component (button or dropdown) */
|
|
65
|
+
id: ODId;
|
|
66
|
+
/**The discord component or `\n` when it is a spacer between action rows */
|
|
67
|
+
component: discord.MessageActionRowComponentBuilder | "\n" | null;
|
|
68
|
+
}
|
|
69
|
+
/**## ODButtonManager `class`
|
|
70
|
+
* This is an Open Discord button manager.
|
|
71
|
+
*
|
|
72
|
+
* It contains all Open Discord button builders. Here, you can add your own buttons or edit existing ones!
|
|
73
|
+
*
|
|
74
|
+
* It's recommended to use this system in combination with all the other Open Discord builders!
|
|
75
|
+
*/
|
|
76
|
+
export declare class ODButtonManager extends ODManagerWithSafety<ODButton<string, any>> {
|
|
77
|
+
constructor(debug: ODDebugger);
|
|
78
|
+
/**Get a newline component for buttons & dropdowns! */
|
|
79
|
+
getNewLine(id: ODValidId): ODComponentBuildResult;
|
|
80
|
+
}
|
|
81
|
+
/**## ODButtonData `interface`
|
|
82
|
+
* This interface contains the data to build a button.
|
|
83
|
+
*/
|
|
84
|
+
export interface ODButtonData {
|
|
85
|
+
/**The custom id of this button */
|
|
86
|
+
customId: string;
|
|
87
|
+
/**The mode of this button */
|
|
88
|
+
mode: "button" | "url";
|
|
89
|
+
/**The url for when the mode is set to "url" */
|
|
90
|
+
url: string | null;
|
|
91
|
+
/**The button color */
|
|
92
|
+
color: ODValidButtonColor | null;
|
|
93
|
+
/**The button label */
|
|
94
|
+
label: string | null;
|
|
95
|
+
/**The button emoji */
|
|
96
|
+
emoji: string | null;
|
|
97
|
+
/**Is the button disabled? */
|
|
98
|
+
disabled: boolean;
|
|
99
|
+
}
|
|
100
|
+
/**## ODButtonInstance `class`
|
|
101
|
+
* This is an Open Discord button instance.
|
|
102
|
+
*
|
|
103
|
+
* It contains all properties & functions to build a button!
|
|
104
|
+
*/
|
|
105
|
+
export declare class ODButtonInstance {
|
|
106
|
+
/**The current data of this button */
|
|
107
|
+
data: ODButtonData;
|
|
108
|
+
/**Set the custom id of this button */
|
|
109
|
+
setCustomId(id: ODButtonData["customId"]): this;
|
|
110
|
+
/**Set the mode of this button */
|
|
111
|
+
setMode(mode: ODButtonData["mode"]): this;
|
|
112
|
+
/**Set the url of this button */
|
|
113
|
+
setUrl(url: ODButtonData["url"]): this;
|
|
114
|
+
/**Set the color of this button */
|
|
115
|
+
setColor(color: ODButtonData["color"]): this;
|
|
116
|
+
/**Set the label of this button */
|
|
117
|
+
setLabel(label: ODButtonData["label"]): this;
|
|
118
|
+
/**Set the emoji of this button */
|
|
119
|
+
setEmoji(emoji: ODButtonData["emoji"]): this;
|
|
120
|
+
/**Disable this button */
|
|
121
|
+
setDisabled(disabled: ODButtonData["disabled"]): this;
|
|
122
|
+
}
|
|
123
|
+
/**## ODButton `class`
|
|
124
|
+
* This is an Open Discord button builder.
|
|
125
|
+
*
|
|
126
|
+
* With this class, you can create a button to use in a message.
|
|
127
|
+
* The only difference with normal buttons is that this one can be edited by Open Discord plugins!
|
|
128
|
+
*
|
|
129
|
+
* This is possible by using "workers" or multiple functions that will be executed in priority order!
|
|
130
|
+
*/
|
|
131
|
+
export declare class ODButton<Source extends string, Params> extends ODBuilderImplementation<ODButtonInstance, Source, Params, ODComponentBuildResult> {
|
|
132
|
+
/**Build this button & compile it for discord.js */
|
|
133
|
+
build(source: Source, params: Params): Promise<ODComponentBuildResult>;
|
|
134
|
+
}
|
|
135
|
+
/**## ODQuickButton `class`
|
|
136
|
+
* This is an Open Discord quick button builder.
|
|
137
|
+
*
|
|
138
|
+
* With this class, you can quickly create a button to use in a message.
|
|
139
|
+
* This quick button can be used by Open Discord plugins instead of the normal builders to speed up the process!
|
|
140
|
+
*
|
|
141
|
+
* Because of the quick functionality, these buttons are less customisable by other plugins.
|
|
142
|
+
*/
|
|
143
|
+
export declare class ODQuickButton {
|
|
144
|
+
/**The id of this button. */
|
|
145
|
+
id: ODId;
|
|
146
|
+
/**The current data of this button */
|
|
147
|
+
data: Partial<ODButtonData>;
|
|
148
|
+
constructor(id: ODValidId, data: Partial<ODButtonData>);
|
|
149
|
+
/**Build this button & compile it for discord.js */
|
|
150
|
+
build(): Promise<ODComponentBuildResult>;
|
|
151
|
+
}
|
|
152
|
+
/**## ODDropdownManager `class`
|
|
153
|
+
* This is an Open Discord dropdown manager.
|
|
154
|
+
*
|
|
155
|
+
* It contains all Open Discord dropdown builders. Here, you can add your own dropdowns or edit existing ones!
|
|
156
|
+
*
|
|
157
|
+
* It's recommended to use this system in combination with all the other Open Discord builders!
|
|
158
|
+
*/
|
|
159
|
+
export declare class ODDropdownManager extends ODManagerWithSafety<ODDropdown<string, any>> {
|
|
160
|
+
constructor(debug: ODDebugger);
|
|
161
|
+
/**Get a newline component for buttons & dropdowns! */
|
|
162
|
+
getNewLine(id: ODValidId): ODComponentBuildResult;
|
|
163
|
+
}
|
|
164
|
+
/**## ODDropdownData `interface`
|
|
165
|
+
* This interface contains the data to build a dropdown.
|
|
166
|
+
*/
|
|
167
|
+
export interface ODDropdownData {
|
|
168
|
+
/**The custom id of this dropdown */
|
|
169
|
+
customId: string;
|
|
170
|
+
/**The type of this dropdown */
|
|
171
|
+
type: "string" | "role" | "channel" | "user" | "mentionable";
|
|
172
|
+
/**The placeholder of this dropdown */
|
|
173
|
+
placeholder: string | null;
|
|
174
|
+
/**The minimum amount of items to be selected in this dropdown */
|
|
175
|
+
minValues: number | null;
|
|
176
|
+
/**The maximum amount of items to be selected in this dropdown */
|
|
177
|
+
maxValues: number | null;
|
|
178
|
+
/**Is this dropdown disabled? */
|
|
179
|
+
disabled: boolean;
|
|
180
|
+
/**Allowed channel types when the type is "channel" */
|
|
181
|
+
channelTypes: discord.ChannelType[];
|
|
182
|
+
/**The options when the type is "string" */
|
|
183
|
+
options: discord.SelectMenuComponentOptionData[];
|
|
184
|
+
/**The options when the type is "user" */
|
|
185
|
+
users: discord.User[];
|
|
186
|
+
/**The options when the type is "role" */
|
|
187
|
+
roles: discord.Role[];
|
|
188
|
+
/**The options when the type is "channel" */
|
|
189
|
+
channels: discord.Channel[];
|
|
190
|
+
/**The options when the type is "mentionable" */
|
|
191
|
+
mentionables: (discord.User | discord.Role)[];
|
|
192
|
+
}
|
|
193
|
+
/**## ODDropdownInstance `class`
|
|
194
|
+
* This is an Open Discord dropdown instance.
|
|
195
|
+
*
|
|
196
|
+
* It contains all properties & functions to build a dropdown!
|
|
197
|
+
*/
|
|
198
|
+
export declare class ODDropdownInstance {
|
|
199
|
+
/**The current data of this dropdown */
|
|
200
|
+
data: ODDropdownData;
|
|
201
|
+
/**Set the custom id of this dropdown */
|
|
202
|
+
setCustomId(id: ODDropdownData["customId"]): this;
|
|
203
|
+
/**Set the type of this dropdown */
|
|
204
|
+
setType(type: ODDropdownData["type"]): this;
|
|
205
|
+
/**Set the placeholder of this dropdown */
|
|
206
|
+
setPlaceholder(placeholder: ODDropdownData["placeholder"]): this;
|
|
207
|
+
/**Set the minimum amount of values in this dropdown */
|
|
208
|
+
setMinValues(minValues: ODDropdownData["minValues"]): this;
|
|
209
|
+
/**Set the maximum amount of values ax this dropdown */
|
|
210
|
+
setMaxValues(maxValues: ODDropdownData["maxValues"]): this;
|
|
211
|
+
/**Set the disabled of this dropdown */
|
|
212
|
+
setDisabled(disabled: ODDropdownData["disabled"]): this;
|
|
213
|
+
/**Set the channel types of this dropdown */
|
|
214
|
+
setChannelTypes(channelTypes: ODDropdownData["channelTypes"]): this;
|
|
215
|
+
/**Set the options of this dropdown (when `type == "string"`) */
|
|
216
|
+
setOptions(options: ODDropdownData["options"]): this;
|
|
217
|
+
/**Set the users of this dropdown (when `type == "user"`) */
|
|
218
|
+
setUsers(users: ODDropdownData["users"]): this;
|
|
219
|
+
/**Set the roles of this dropdown (when `type == "role"`) */
|
|
220
|
+
setRoles(roles: ODDropdownData["roles"]): this;
|
|
221
|
+
/**Set the channels of this dropdown (when `type == "channel"`) */
|
|
222
|
+
setChannels(channels: ODDropdownData["channels"]): this;
|
|
223
|
+
/**Set the mentionables of this dropdown (when `type == "mentionable"`) */
|
|
224
|
+
setMentionables(mentionables: ODDropdownData["mentionables"]): this;
|
|
225
|
+
}
|
|
226
|
+
/**## ODDropdown `class`
|
|
227
|
+
* This is an Open Discord dropdown builder.
|
|
228
|
+
*
|
|
229
|
+
* With this class, you can create a dropdown to use in a message.
|
|
230
|
+
* The only difference with normal dropdowns is that this one can be edited by Open Discord plugins!
|
|
231
|
+
*
|
|
232
|
+
* This is possible by using "workers" or multiple functions that will be executed in priority order!
|
|
233
|
+
*/
|
|
234
|
+
export declare class ODDropdown<Source extends string, Params> extends ODBuilderImplementation<ODDropdownInstance, Source, Params, ODComponentBuildResult> {
|
|
235
|
+
/**Build this dropdown & compile it for discord.js */
|
|
236
|
+
build(source: Source, params: Params): Promise<ODComponentBuildResult>;
|
|
237
|
+
}
|
|
238
|
+
/**## ODQuickDropdown `class`
|
|
239
|
+
* This is an Open Discord quick dropdown builder.
|
|
240
|
+
*
|
|
241
|
+
* With this class, you can quickly create a dropdown to use in a message.
|
|
242
|
+
* This quick dropdown can be used by Open Discord plugins instead of the normal builders to speed up the process!
|
|
243
|
+
*
|
|
244
|
+
* Because of the quick functionality, these dropdowns are less customisable by other plugins.
|
|
245
|
+
*/
|
|
246
|
+
export declare class ODQuickDropdown {
|
|
247
|
+
/**The id of this dropdown. */
|
|
248
|
+
id: ODId;
|
|
249
|
+
/**The current data of this dropdown */
|
|
250
|
+
data: Partial<ODDropdownData>;
|
|
251
|
+
constructor(id: ODValidId, data: Partial<ODDropdownData>);
|
|
252
|
+
/**Build this dropdown & compile it for discord.js */
|
|
253
|
+
build(): Promise<ODComponentBuildResult>;
|
|
254
|
+
}
|
|
255
|
+
/**## ODFileManager `class`
|
|
256
|
+
* This is an Open Discord file manager.
|
|
257
|
+
*
|
|
258
|
+
* It contains all Open Discord file builders. Here, you can add your own files or edit existing ones!
|
|
259
|
+
*
|
|
260
|
+
* It's recommended to use this system in combination with all the other Open Discord builders!
|
|
261
|
+
*/
|
|
262
|
+
export declare class ODFileManager extends ODManagerWithSafety<ODFile<string, any>> {
|
|
263
|
+
constructor(debug: ODDebugger);
|
|
264
|
+
}
|
|
265
|
+
/**## ODFileData `interface`
|
|
266
|
+
* This interface contains the data to build a file.
|
|
267
|
+
*/
|
|
268
|
+
export interface ODFileData {
|
|
269
|
+
/**The file buffer, string or raw data */
|
|
270
|
+
file: discord.BufferResolvable;
|
|
271
|
+
/**The name of the file */
|
|
272
|
+
name: string;
|
|
273
|
+
/**The description of the file */
|
|
274
|
+
description: string | null;
|
|
275
|
+
/**Set the file to be a spoiler */
|
|
276
|
+
spoiler: boolean;
|
|
277
|
+
}
|
|
278
|
+
/**## ODFileBuildResult `interface`
|
|
279
|
+
* This interface contains the result from a built file (attachment). This can be used in the `ODMessage` builder!
|
|
280
|
+
*/
|
|
281
|
+
export interface ODFileBuildResult {
|
|
282
|
+
/**The id of this file */
|
|
283
|
+
id: ODId;
|
|
284
|
+
/**The discord file */
|
|
285
|
+
file: discord.AttachmentBuilder | null;
|
|
286
|
+
}
|
|
287
|
+
/**## ODFileInstance `class`
|
|
288
|
+
* This is an Open Discord file instance.
|
|
289
|
+
*
|
|
290
|
+
* It contains all properties & functions to build a file!
|
|
291
|
+
*/
|
|
292
|
+
export declare class ODFileInstance {
|
|
293
|
+
/**The current data of this file */
|
|
294
|
+
data: ODFileData;
|
|
295
|
+
/**Set the file path of this attachment */
|
|
296
|
+
setFile(file: string): this;
|
|
297
|
+
/**Set the file contents of this attachment */
|
|
298
|
+
setContents(contents: string | Buffer): this;
|
|
299
|
+
/**Set the name of this attachment */
|
|
300
|
+
setName(name: ODFileData["name"]): this;
|
|
301
|
+
/**Set the description of this attachment */
|
|
302
|
+
setDescription(description: ODFileData["description"]): this;
|
|
303
|
+
/**Set this attachment to show as a spoiler */
|
|
304
|
+
setSpoiler(spoiler: ODFileData["spoiler"]): this;
|
|
305
|
+
}
|
|
306
|
+
/**## ODFile `class`
|
|
307
|
+
* This is an Open Discord file builder.
|
|
308
|
+
*
|
|
309
|
+
* With this class, you can create a file to use in a message.
|
|
310
|
+
* The only difference with normal files is that this one can be edited by Open Discord plugins!
|
|
311
|
+
*
|
|
312
|
+
* This is possible by using "workers" or multiple functions that will be executed in priority order!
|
|
313
|
+
*/
|
|
314
|
+
export declare class ODFile<Source extends string, Params> extends ODBuilderImplementation<ODFileInstance, Source, Params, ODFileBuildResult> {
|
|
315
|
+
/**Build this attachment & compile it for discord.js */
|
|
316
|
+
build(source: Source, params: Params): Promise<ODFileBuildResult>;
|
|
317
|
+
}
|
|
318
|
+
/**## ODQuickFile `class`
|
|
319
|
+
* This is an Open Discord quick file builder.
|
|
320
|
+
*
|
|
321
|
+
* With this class, you can quickly create a file to use in a message.
|
|
322
|
+
* This quick file can be used by Open Discord plugins instead of the normal builders to speed up the process!
|
|
323
|
+
*
|
|
324
|
+
* Because of the quick functionality, these files are less customisable by other plugins.
|
|
325
|
+
*/
|
|
326
|
+
export declare class ODQuickFile {
|
|
327
|
+
/**The id of this file. */
|
|
328
|
+
id: ODId;
|
|
329
|
+
/**The current data of this file */
|
|
330
|
+
data: Partial<ODFileData>;
|
|
331
|
+
constructor(id: ODValidId, data: Partial<ODFileData>);
|
|
332
|
+
/**Build this attachment & compile it for discord.js */
|
|
333
|
+
build(): Promise<ODFileBuildResult>;
|
|
334
|
+
}
|
|
335
|
+
/**## ODEmbedManager `class`
|
|
336
|
+
* This is an Open Discord embed manager.
|
|
337
|
+
*
|
|
338
|
+
* It contains all Open Discord embed builders. Here, you can add your own embeds or edit existing ones!
|
|
339
|
+
*
|
|
340
|
+
* It's recommended to use this system in combination with all the other Open Discord builders!
|
|
341
|
+
*/
|
|
342
|
+
export declare class ODEmbedManager extends ODManagerWithSafety<ODEmbed<string, any>> {
|
|
343
|
+
constructor(debug: ODDebugger);
|
|
344
|
+
}
|
|
345
|
+
/**## ODEmbedData `interface`
|
|
346
|
+
* This interface contains the data to build an embed.
|
|
347
|
+
*/
|
|
348
|
+
export interface ODEmbedData {
|
|
349
|
+
/**The title of the embed */
|
|
350
|
+
title: string | null;
|
|
351
|
+
/**The color of the embed */
|
|
352
|
+
color: discord.ColorResolvable | string | null;
|
|
353
|
+
/**The url of the embed */
|
|
354
|
+
url: string | null;
|
|
355
|
+
/**The description of the embed */
|
|
356
|
+
description: string | null;
|
|
357
|
+
/**The author text of the embed */
|
|
358
|
+
authorText: string | null;
|
|
359
|
+
/**The author image of the embed */
|
|
360
|
+
authorImage: string | null;
|
|
361
|
+
/**The author url of the embed */
|
|
362
|
+
authorUrl: string | null;
|
|
363
|
+
/**The footer text of the embed */
|
|
364
|
+
footerText: string | null;
|
|
365
|
+
/**The footer image of the embed */
|
|
366
|
+
footerImage: string | null;
|
|
367
|
+
/**The image of the embed */
|
|
368
|
+
image: string | null;
|
|
369
|
+
/**The thumbnail of the embed */
|
|
370
|
+
thumbnail: string | null;
|
|
371
|
+
/**The fields of the embed */
|
|
372
|
+
fields: ODInterfaceWithPartialProperty<discord.EmbedField, "inline">[];
|
|
373
|
+
/**The timestamp of the embed */
|
|
374
|
+
timestamp: number | Date | null;
|
|
375
|
+
}
|
|
376
|
+
/**## ODEmbedBuildResult `interface`
|
|
377
|
+
* This interface contains the result from a built embed. This can be used in the `ODMessage` builder!
|
|
378
|
+
*/
|
|
379
|
+
export interface ODEmbedBuildResult {
|
|
380
|
+
/**The id of this embed */
|
|
381
|
+
id: ODId;
|
|
382
|
+
/**The discord embed */
|
|
383
|
+
embed: discord.EmbedBuilder | null;
|
|
384
|
+
}
|
|
385
|
+
/**## ODEmbedInstance `class`
|
|
386
|
+
* This is an Open Discord embed instance.
|
|
387
|
+
*
|
|
388
|
+
* It contains all properties & functions to build an embed!
|
|
389
|
+
*/
|
|
390
|
+
export declare class ODEmbedInstance {
|
|
391
|
+
/**The current data of this embed */
|
|
392
|
+
data: ODEmbedData;
|
|
393
|
+
/**Set the title of this embed */
|
|
394
|
+
setTitle(title: ODEmbedData["title"]): this;
|
|
395
|
+
/**Set the color of this embed */
|
|
396
|
+
setColor(color: ODEmbedData["color"]): this;
|
|
397
|
+
/**Set the url of this embed */
|
|
398
|
+
setUrl(url: ODEmbedData["url"]): this;
|
|
399
|
+
/**Set the description of this embed */
|
|
400
|
+
setDescription(description: ODEmbedData["description"]): this;
|
|
401
|
+
/**Set the author of this embed */
|
|
402
|
+
setAuthor(text: ODEmbedData["authorText"], image?: ODEmbedData["authorImage"], url?: ODEmbedData["authorUrl"]): this;
|
|
403
|
+
/**Set the footer of this embed */
|
|
404
|
+
setFooter(text: ODEmbedData["footerText"], image?: ODEmbedData["footerImage"]): this;
|
|
405
|
+
/**Set the image of this embed */
|
|
406
|
+
setImage(image: ODEmbedData["image"]): this;
|
|
407
|
+
/**Set the thumbnail of this embed */
|
|
408
|
+
setThumbnail(thumbnail: ODEmbedData["thumbnail"]): this;
|
|
409
|
+
/**Set the fields of this embed */
|
|
410
|
+
setFields(fields: ODEmbedData["fields"]): this;
|
|
411
|
+
/**Add fields to this embed */
|
|
412
|
+
addFields(...fields: ODEmbedData["fields"]): this;
|
|
413
|
+
/**Clear all fields from this embed */
|
|
414
|
+
clearFields(): this;
|
|
415
|
+
/**Set the timestamp of this embed */
|
|
416
|
+
setTimestamp(timestamp: ODEmbedData["timestamp"]): this;
|
|
417
|
+
}
|
|
418
|
+
/**## ODEmbed `class`
|
|
419
|
+
* This is an Open Discord embed builder.
|
|
420
|
+
*
|
|
421
|
+
* With this class, you can create a embed to use in a message.
|
|
422
|
+
* The only difference with normal embeds is that this one can be edited by Open Discord plugins!
|
|
423
|
+
*
|
|
424
|
+
* This is possible by using "workers" or multiple functions that will be executed in priority order!
|
|
425
|
+
*/
|
|
426
|
+
export declare class ODEmbed<Source extends string, Params> extends ODBuilderImplementation<ODEmbedInstance, Source, Params, ODEmbedBuildResult> {
|
|
427
|
+
/**Build this embed & compile it for discord.js */
|
|
428
|
+
build(source: Source, params: Params): Promise<ODEmbedBuildResult>;
|
|
429
|
+
}
|
|
430
|
+
/**## ODQuickEmbed `class`
|
|
431
|
+
* This is an Open Discord quick embed builder.
|
|
432
|
+
*
|
|
433
|
+
* With this class, you can quickly create a embed to use in a message.
|
|
434
|
+
* This quick embed can be used by Open Discord plugins instead of the normal builders to speed up the process!
|
|
435
|
+
*
|
|
436
|
+
* Because of the quick functionality, these embeds are less customisable by other plugins.
|
|
437
|
+
*/
|
|
438
|
+
export declare class ODQuickEmbed {
|
|
439
|
+
/**The id of this embed. */
|
|
440
|
+
id: ODId;
|
|
441
|
+
/**The current data of this embed */
|
|
442
|
+
data: Partial<ODEmbedData>;
|
|
443
|
+
constructor(id: ODValidId, data: Partial<ODEmbedData>);
|
|
444
|
+
/**Build this embed & compile it for discord.js */
|
|
445
|
+
build(): Promise<ODEmbedBuildResult>;
|
|
446
|
+
}
|
|
447
|
+
/**## ODMessageManager `class`
|
|
448
|
+
* This is an Open Discord message manager.
|
|
449
|
+
*
|
|
450
|
+
* It contains all Open Discord message builders. Here, you can add your own messages or edit existing ones!
|
|
451
|
+
*
|
|
452
|
+
* It's recommended to use this system in combination with all the other Open Discord builders!
|
|
453
|
+
*/
|
|
454
|
+
export declare class ODMessageManager extends ODManagerWithSafety<ODMessage<string, any>> {
|
|
455
|
+
constructor(debug: ODDebugger);
|
|
456
|
+
}
|
|
457
|
+
/**## ODMessageData `interface`
|
|
458
|
+
* This interface contains the data to build a message.
|
|
459
|
+
*/
|
|
460
|
+
export interface ODMessageData {
|
|
461
|
+
/**The content of this message. `null` when no content */
|
|
462
|
+
content: string | null;
|
|
463
|
+
/**Poll data for this message */
|
|
464
|
+
poll: discord.PollData | null;
|
|
465
|
+
/**Try to make this message ephemeral when available */
|
|
466
|
+
ephemeral: boolean;
|
|
467
|
+
/**Embeds from this message */
|
|
468
|
+
embeds: ODEmbedBuildResult[];
|
|
469
|
+
/**Components from this message */
|
|
470
|
+
components: ODComponentBuildResult[];
|
|
471
|
+
/**Files from this message */
|
|
472
|
+
files: ODFileBuildResult[];
|
|
473
|
+
/**Additional options that aren't covered by the Open Discord api!*/
|
|
474
|
+
additionalOptions: Omit<discord.MessageCreateOptions, "poll" | "content" | "embeds" | "components" | "files" | "flags">;
|
|
475
|
+
}
|
|
476
|
+
/**## ODMessageBuildResult `interface`
|
|
477
|
+
* This interface contains the result from a built message. This can be sent in a discord channel!
|
|
478
|
+
*/
|
|
479
|
+
export interface ODMessageBuildResult {
|
|
480
|
+
/**The id of this message */
|
|
481
|
+
id: ODId;
|
|
482
|
+
/**The discord message */
|
|
483
|
+
message: Omit<discord.MessageCreateOptions, "flags">;
|
|
484
|
+
/**When enabled, the bot will try to send this as an ephemeral message */
|
|
485
|
+
ephemeral: boolean;
|
|
486
|
+
}
|
|
487
|
+
/**## ODMessageBuildSentResult `interface`
|
|
488
|
+
* This interface contains the result from a sent built message. This can be used to edit, view & save the message that got created.
|
|
489
|
+
*/
|
|
490
|
+
export interface ODMessageBuildSentResult<InGuild extends boolean> {
|
|
491
|
+
/**Did the message get sent successfully? */
|
|
492
|
+
success: boolean;
|
|
493
|
+
/**The message that got sent. */
|
|
494
|
+
message: discord.Message<InGuild> | null;
|
|
495
|
+
}
|
|
496
|
+
/**## ODMessageInstance `class`
|
|
497
|
+
* This is an Open Discord message instance.
|
|
498
|
+
*
|
|
499
|
+
* It contains all properties & functions to build a message!
|
|
500
|
+
*/
|
|
501
|
+
export declare class ODMessageInstance {
|
|
502
|
+
/**The current data of this message */
|
|
503
|
+
data: ODMessageData;
|
|
504
|
+
/**Set the content of this message */
|
|
505
|
+
setContent(content: ODMessageData["content"]): this;
|
|
506
|
+
/**Set the poll of this message */
|
|
507
|
+
setPoll(poll: ODMessageData["poll"]): this;
|
|
508
|
+
/**Make this message ephemeral when possible */
|
|
509
|
+
setEphemeral(ephemeral: ODMessageData["ephemeral"]): this;
|
|
510
|
+
/**Set the embeds of this message */
|
|
511
|
+
setEmbeds(...embeds: ODEmbedBuildResult[]): this;
|
|
512
|
+
/**Add an embed to this message! */
|
|
513
|
+
addEmbed(embed: ODEmbedBuildResult): this;
|
|
514
|
+
/**Remove an embed from this message */
|
|
515
|
+
removeEmbed(id: ODValidId): this;
|
|
516
|
+
/**Get an embed from this message */
|
|
517
|
+
getEmbed(id: ODValidId): discord.EmbedBuilder | null;
|
|
518
|
+
/**Set the components of this message */
|
|
519
|
+
setComponents(...components: ODComponentBuildResult[]): this;
|
|
520
|
+
/**Add a component to this message! */
|
|
521
|
+
addComponent(component: ODComponentBuildResult): this;
|
|
522
|
+
/**Remove a component from this message */
|
|
523
|
+
removeComponent(id: ODValidId): this;
|
|
524
|
+
/**Get a component from this message */
|
|
525
|
+
getComponent(id: ODValidId): "\n" | discord.MessageActionRowComponentBuilder | null;
|
|
526
|
+
/**Set the files of this message */
|
|
527
|
+
setFiles(...files: ODFileBuildResult[]): this;
|
|
528
|
+
/**Add a file to this message! */
|
|
529
|
+
addFile(file: ODFileBuildResult): this;
|
|
530
|
+
/**Remove a file from this message */
|
|
531
|
+
removeFile(id: ODValidId): this;
|
|
532
|
+
/**Get a file from this message */
|
|
533
|
+
getFile(id: ODValidId): discord.AttachmentBuilder | null;
|
|
534
|
+
}
|
|
535
|
+
/**## ODMessage `class`
|
|
536
|
+
* This is an Open Discord message builder.
|
|
537
|
+
*
|
|
538
|
+
* With this class, you can create a message to send in a discord channel.
|
|
539
|
+
* The only difference with normal messages is that this one can be edited by Open Discord plugins!
|
|
540
|
+
*
|
|
541
|
+
* This is possible by using "workers" or multiple functions that will be executed in priority order!
|
|
542
|
+
*/
|
|
543
|
+
export declare class ODMessage<Source extends string, Params> extends ODBuilderImplementation<ODMessageInstance, Source, Params, ODMessageBuildResult> {
|
|
544
|
+
/**Build this message & compile it for discord.js */
|
|
545
|
+
build(source: Source, params: Params): Promise<ODMessageBuildResult>;
|
|
546
|
+
}
|
|
547
|
+
/**## ODQuickMessage `class`
|
|
548
|
+
* This is an Open Discord quick message builder.
|
|
549
|
+
*
|
|
550
|
+
* With this class, you can quickly create a message to send in a discord channel.
|
|
551
|
+
* This quick message can be used by Open Discord plugins instead of the normal builders to speed up the process!
|
|
552
|
+
*
|
|
553
|
+
* Because of the quick functionality, these messages are less customisable by other plugins.
|
|
554
|
+
*/
|
|
555
|
+
export declare class ODQuickMessage {
|
|
556
|
+
/**The id of this message. */
|
|
557
|
+
id: ODId;
|
|
558
|
+
/**The current data of this message. */
|
|
559
|
+
data: Partial<ODMessageData>;
|
|
560
|
+
constructor(id: ODValidId, data: Partial<ODMessageData>);
|
|
561
|
+
/**Build this message & compile it for discord.js */
|
|
562
|
+
build(): Promise<ODMessageBuildResult>;
|
|
563
|
+
}
|
|
564
|
+
/**## ODModalManager `class`
|
|
565
|
+
* This is an Open Discord modal manager.
|
|
566
|
+
*
|
|
567
|
+
* It contains all Open Discord modal builders. Here, you can add your own modals or edit existing ones!
|
|
568
|
+
*
|
|
569
|
+
* It's recommended to use this system in combination with all the other Open Discord builders!
|
|
570
|
+
*/
|
|
571
|
+
export declare class ODModalManager extends ODManagerWithSafety<ODModal<string, any>> {
|
|
572
|
+
constructor(debug: ODDebugger);
|
|
573
|
+
}
|
|
574
|
+
/**## ODModalDataQuestion `interface`
|
|
575
|
+
* This interface contains the data to build a modal question.
|
|
576
|
+
*/
|
|
577
|
+
export interface ODModalDataQuestion {
|
|
578
|
+
/**The style of this modal question */
|
|
579
|
+
style: "short" | "paragraph";
|
|
580
|
+
/**The custom id of this modal question */
|
|
581
|
+
customId: string;
|
|
582
|
+
/**The label of this modal question */
|
|
583
|
+
label?: string;
|
|
584
|
+
/**The min length of this modal question */
|
|
585
|
+
minLength?: number;
|
|
586
|
+
/**The max length of this modal question */
|
|
587
|
+
maxLength?: number;
|
|
588
|
+
/**Is this modal question required? */
|
|
589
|
+
required?: boolean;
|
|
590
|
+
/**The placeholder of this modal question */
|
|
591
|
+
placeholder?: string;
|
|
592
|
+
/**The initial value of this modal question */
|
|
593
|
+
value?: string;
|
|
594
|
+
}
|
|
595
|
+
/**## ODModalData `interface`
|
|
596
|
+
* This interface contains the data to build a modal.
|
|
597
|
+
*/
|
|
598
|
+
export interface ODModalData {
|
|
599
|
+
/**The custom id of this modal */
|
|
600
|
+
customId: string;
|
|
601
|
+
/**The title of this modal */
|
|
602
|
+
title: string | null;
|
|
603
|
+
/**The collection of questions in this modal */
|
|
604
|
+
questions: ODModalDataQuestion[];
|
|
605
|
+
}
|
|
606
|
+
/**## ODModalBuildResult `interface`
|
|
607
|
+
* This interface contains the result from a built modal (form). This can be used in the `ODMessage` builder!
|
|
608
|
+
*/
|
|
609
|
+
export interface ODModalBuildResult {
|
|
610
|
+
/**The id of this modal */
|
|
611
|
+
id: ODId;
|
|
612
|
+
/**The discord modal */
|
|
613
|
+
modal: discord.ModalBuilder;
|
|
614
|
+
}
|
|
615
|
+
/**## ODModalInstance `class`
|
|
616
|
+
* This is an Open Discord modal instance.
|
|
617
|
+
*
|
|
618
|
+
* It contains all properties & functions to build a modal!
|
|
619
|
+
*/
|
|
620
|
+
export declare class ODModalInstance {
|
|
621
|
+
/**The current data of this modal */
|
|
622
|
+
data: ODModalData;
|
|
623
|
+
/**Set the custom id of this modal */
|
|
624
|
+
setCustomId(customId: ODModalData["customId"]): this;
|
|
625
|
+
/**Set the title of this modal */
|
|
626
|
+
setTitle(title: ODModalData["title"]): this;
|
|
627
|
+
/**Set the questions of this modal */
|
|
628
|
+
setQuestions(...questions: ODModalData["questions"]): this;
|
|
629
|
+
/**Add a question to this modal! */
|
|
630
|
+
addQuestion(question: ODModalDataQuestion): this;
|
|
631
|
+
/**Remove a question from this modal */
|
|
632
|
+
removeQuestion(customId: string): this;
|
|
633
|
+
/**Get a question from this modal */
|
|
634
|
+
getQuestion(customId: string): ODModalDataQuestion | null;
|
|
635
|
+
}
|
|
636
|
+
/**## ODModal `class`
|
|
637
|
+
* This is an Open Discord modal builder.
|
|
638
|
+
*
|
|
639
|
+
* With this class, you can create a modal to use as response in interactions.
|
|
640
|
+
* The only difference with normal modals is that this one can be edited by Open Discord plugins!
|
|
641
|
+
*
|
|
642
|
+
* This is possible by using "workers" or multiple functions that will be executed in priority order!
|
|
643
|
+
*/
|
|
644
|
+
export declare class ODModal<Source extends string, Params> extends ODBuilderImplementation<ODModalInstance, Source, Params, ODModalBuildResult> {
|
|
645
|
+
/**Build this modal & compile it for discord.js */
|
|
646
|
+
build(source: Source, params: Params): Promise<ODModalBuildResult>;
|
|
647
|
+
}
|