@open-discord-bots/framework 0.2.17 → 0.3.1
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/dist/api/index.d.ts +16 -15
- package/dist/api/index.js +16 -15
- package/dist/api/main.d.ts +31 -23
- package/dist/api/main.js +3 -1
- package/dist/api/modules/action.d.ts +2 -2
- package/dist/api/modules/action.js +1 -5
- package/dist/api/modules/base.d.ts +29 -11
- package/dist/api/modules/base.js +78 -80
- package/dist/api/modules/builder.d.ts +2 -11
- package/dist/api/modules/builder.js +0 -4
- package/dist/api/modules/checker.d.ts +28 -7
- package/dist/api/modules/checker.js +33 -37
- package/dist/api/modules/client.d.ts +66 -14
- package/dist/api/modules/client.js +146 -132
- package/dist/api/modules/component.d.ts +928 -0
- package/dist/api/modules/component.js +1346 -0
- package/dist/api/modules/config.d.ts +30 -2
- package/dist/api/modules/config.js +90 -7
- package/dist/api/modules/console.d.ts +16 -4
- package/dist/api/modules/console.js +25 -25
- package/dist/api/modules/cooldown.d.ts +5 -5
- package/dist/api/modules/cooldown.js +1 -17
- package/dist/api/modules/database.d.ts +21 -13
- package/dist/api/modules/database.js +0 -23
- package/dist/api/modules/event.d.ts +4 -2
- package/dist/api/modules/event.js +8 -10
- package/dist/api/modules/fuse.d.ts +1 -1
- package/dist/api/modules/helpmenu.d.ts +11 -9
- package/dist/api/modules/helpmenu.js +24 -22
- package/dist/api/modules/language.d.ts +4 -3
- package/dist/api/modules/language.js +9 -16
- package/dist/api/modules/permission.d.ts +10 -1
- package/dist/api/modules/permission.js +17 -20
- package/dist/api/modules/plugin.d.ts +2 -1
- package/dist/api/modules/plugin.js +2 -2
- package/dist/api/modules/post.d.ts +12 -4
- package/dist/api/modules/post.js +36 -10
- package/dist/api/modules/progressbar.d.ts +18 -6
- package/dist/api/modules/progressbar.js +35 -35
- package/dist/api/modules/responder.d.ts +97 -28
- package/dist/api/modules/responder.js +213 -176
- package/dist/api/modules/session.d.ts +11 -2
- package/dist/api/modules/session.js +16 -16
- package/dist/api/modules/startscreen.d.ts +2 -3
- package/dist/api/modules/startscreen.js +8 -9
- package/dist/api/modules/statistic.d.ts +2 -1
- package/dist/api/modules/statistic.js +4 -7
- package/dist/api/modules/worker.d.ts +2 -1
- package/dist/api/modules/worker.js +3 -3
- package/package.json +3 -2
- package/src/api/index.ts +16 -15
- package/src/api/main.ts +33 -24
- package/src/api/modules/action.ts +2 -4
- package/src/api/modules/base.ts +77 -79
- package/src/api/modules/builder.ts +2 -14
- package/src/api/modules/checker.ts +36 -37
- package/src/api/modules/client.ts +144 -136
- package/src/api/modules/component.ts +1826 -0
- package/src/api/modules/config.ts +86 -7
- package/src/api/modules/console.ts +25 -25
- package/src/api/modules/cooldown.ts +8 -13
- package/src/api/modules/database.ts +24 -32
- package/src/api/modules/event.ts +6 -10
- package/src/api/modules/fuse.ts +1 -1
- package/src/api/modules/helpmenu.ts +31 -27
- package/src/api/modules/language.ts +11 -16
- package/src/api/modules/permission.ts +17 -20
- package/src/api/modules/plugin.ts +2 -2
- package/src/api/modules/post.ts +31 -10
- package/src/api/modules/progressbar.ts +36 -37
- package/src/api/modules/responder.ts +234 -185
- package/src/api/modules/session.ts +15 -15
- package/src/api/modules/startscreen.ts +9 -10
- package/src/api/modules/statistic.ts +4 -7
- package/src/api/modules/worker.ts +3 -3
- package/src/api/modules/component.txt +0 -350
|
@@ -0,0 +1,928 @@
|
|
|
1
|
+
import { ODId, ODValidId, ODManagerData, ODNoGeneric, ODManager, ODValidButtonColor, ODInterfaceWithPartialProperty } from "./base.js";
|
|
2
|
+
import * as discord from "discord.js";
|
|
3
|
+
import { ODWorkerManager, ODWorkerCallback } from "./worker.js";
|
|
4
|
+
import { ODDebugger } from "./console.js";
|
|
5
|
+
/**## ODComponentFactoryInstance `class`
|
|
6
|
+
* An Open Discord component factory instance.
|
|
7
|
+
*
|
|
8
|
+
* It will contain the final root component which is returned by an `ODComponentFactory`.
|
|
9
|
+
* This component can be used in another `ODComponentFactory` or rendered to a message/modal.
|
|
10
|
+
*/
|
|
11
|
+
export declare class ODComponentFactoryInstance<Component extends ODComponent<object, any>> {
|
|
12
|
+
/**The root component of this factory. */
|
|
13
|
+
private rootComponent;
|
|
14
|
+
/**The root component of this factory. */
|
|
15
|
+
getComponent(): Component | null;
|
|
16
|
+
/**Set the root component of this factory. */
|
|
17
|
+
setComponent(c: Component | null): void;
|
|
18
|
+
}
|
|
19
|
+
/**## ODComponentFactory `class`
|
|
20
|
+
* An Open Discord component factory.
|
|
21
|
+
*
|
|
22
|
+
* It is a collection of functions/workers/hooks which will build a Discord message/modal component from scratch.
|
|
23
|
+
* Plugins can intercept and modify these workers to replace default behaviour or layout.
|
|
24
|
+
*/
|
|
25
|
+
export declare class ODComponentFactory<Component extends ODComponent<object, any>, Origin extends string, Params, WorkerIds extends string = string> extends ODManagerData {
|
|
26
|
+
/**A collection of all workers for this component factory. */
|
|
27
|
+
workers: ODWorkerManager<ODComponentFactoryInstance<Component>, Origin, Params, WorkerIds>;
|
|
28
|
+
constructor(id: ODValidId, callback?: ODWorkerCallback<ODComponentFactoryInstance<Component>, Origin, Params>, priority?: number, callbackId?: ODValidId);
|
|
29
|
+
/**Run all workers and return the resulting component. */
|
|
30
|
+
build(origin: Origin, params: Params): Promise<ODComponentInferBuildResult<Component>>;
|
|
31
|
+
}
|
|
32
|
+
/**## ODComponentManagerIdConstraint `type`
|
|
33
|
+
* The constraint/layout for id mappings/interfaces of the `ODComponentManager` class.
|
|
34
|
+
*/
|
|
35
|
+
export type ODComponentManagerIdConstraint = Record<string, {
|
|
36
|
+
origin: string;
|
|
37
|
+
params: object;
|
|
38
|
+
workers: string;
|
|
39
|
+
}>;
|
|
40
|
+
/**## ODBaseComponentManager `class`
|
|
41
|
+
* A generic Open Discord component manager.
|
|
42
|
+
*
|
|
43
|
+
* It contains a collection of all Open Discord component factories. You can:
|
|
44
|
+
* - Add your own message/modal component factories
|
|
45
|
+
* - Modify existing message/modal component factories
|
|
46
|
+
*
|
|
47
|
+
* Messages created using this system are not compatible with `ODBuilder` messages!
|
|
48
|
+
*/
|
|
49
|
+
export declare class ODBaseComponentManager<IdList extends ODComponentManagerIdConstraint = ODComponentManagerIdConstraint, Component extends ODComponent<object, any> = ODComponent<object, any>> extends ODManager<ODComponentFactory<Component, string, {}, string>> {
|
|
50
|
+
get<FactoryId extends keyof ODNoGeneric<IdList>>(id: FactoryId): ODComponentFactory<Component, IdList[FactoryId]["origin"], IdList[FactoryId]["params"], IdList[FactoryId]["workers"]>;
|
|
51
|
+
get(id: ODValidId): ODComponentFactory<Component, string, {}, string> | null;
|
|
52
|
+
remove<FactoryId extends keyof ODNoGeneric<IdList>>(id: FactoryId): ODComponentFactory<Component, IdList[FactoryId]["origin"], IdList[FactoryId]["params"], IdList[FactoryId]["workers"]>;
|
|
53
|
+
remove(id: ODValidId): ODComponentFactory<Component, string, {}, string> | null;
|
|
54
|
+
exists(id: keyof ODNoGeneric<IdList>): boolean;
|
|
55
|
+
exists(id: ODValidId): boolean;
|
|
56
|
+
}
|
|
57
|
+
/**## ODSharedComponentManager `class
|
|
58
|
+
* A special class with types for shared message/modal `ODComponent`'s.
|
|
59
|
+
* Create button, dropdown or any other layout component template to use them in messages & modals.
|
|
60
|
+
*/
|
|
61
|
+
export declare class ODSharedComponentManager<IdList extends ODComponentManagerIdConstraint = ODComponentManagerIdConstraint> extends ODBaseComponentManager<IdList, ODComponent<object, any>> {
|
|
62
|
+
constructor(debug: ODDebugger);
|
|
63
|
+
}
|
|
64
|
+
/**## ODMessageComponentManager `class
|
|
65
|
+
* A special class with types for `ODMessageComponent`'s.
|
|
66
|
+
* Create message templates to use as replies and make use of shared components.
|
|
67
|
+
*/
|
|
68
|
+
export declare class ODMessageComponentManager<IdList extends ODComponentManagerIdConstraint = ODComponentManagerIdConstraint> extends ODBaseComponentManager<IdList, ODMessageComponent | ODSimpleMessageComponent> {
|
|
69
|
+
constructor(debug: ODDebugger);
|
|
70
|
+
}
|
|
71
|
+
/**## ODModalComponentManager `class
|
|
72
|
+
* A special class with types for `ODModalComponent`'s.
|
|
73
|
+
* Create modal templates to use as forms and make use of shared components.
|
|
74
|
+
*/
|
|
75
|
+
export declare class ODModalComponentManager<IdList extends ODComponentManagerIdConstraint = ODComponentManagerIdConstraint> extends ODBaseComponentManager<IdList, ODModalComponent> {
|
|
76
|
+
constructor(debug: ODDebugger);
|
|
77
|
+
}
|
|
78
|
+
/**## ODComponentManager `class`
|
|
79
|
+
* An Open Discord component manager.
|
|
80
|
+
*
|
|
81
|
+
* Create message & modal templates, re-use components and design all visual elements of the bot.
|
|
82
|
+
*
|
|
83
|
+
* Using the Open Discord component system has many advantages compared to vanilla `discord.js`:
|
|
84
|
+
* - Plugins can extend, edit & replace messages & components
|
|
85
|
+
* - Includes automatic error handling
|
|
86
|
+
* - Independent workers/hooks (with priority)
|
|
87
|
+
* - Fail-safe design using try-catch
|
|
88
|
+
* - Automatic switch between components v2 and legacy components depending on message requirements
|
|
89
|
+
* - Get to know the origin of the request (e.g. button, dropdown, modal, ...)
|
|
90
|
+
* - And so much more!
|
|
91
|
+
*/
|
|
92
|
+
export declare class ODComponentManager<SharedIdList extends ODComponentManagerIdConstraint = ODComponentManagerIdConstraint, MessageIdList extends ODComponentManagerIdConstraint = ODComponentManagerIdConstraint, ModalIdList extends ODComponentManagerIdConstraint = ODComponentManagerIdConstraint> {
|
|
93
|
+
/**The manager for all shared components. */
|
|
94
|
+
shared: ODSharedComponentManager<SharedIdList>;
|
|
95
|
+
/**The manager for all messages components. */
|
|
96
|
+
messages: ODMessageComponentManager<MessageIdList>;
|
|
97
|
+
/**The manager for all modals components. */
|
|
98
|
+
modals: ODModalComponentManager<ModalIdList>;
|
|
99
|
+
constructor(debug: ODDebugger);
|
|
100
|
+
}
|
|
101
|
+
/**## ODComponentInferBuildResult `type`
|
|
102
|
+
* Infer the build result of a certain component.
|
|
103
|
+
*/
|
|
104
|
+
export type ODComponentInferBuildResult<Component> = Component extends ODComponent<object, infer BuildResult> ? BuildResult : never;
|
|
105
|
+
/**## ODComponent `class`
|
|
106
|
+
* An Open Discord message/modal component.
|
|
107
|
+
*
|
|
108
|
+
* This class itself doesn't do anything, but is a blueprint for other
|
|
109
|
+
* `ODComponent` classes which represent the new Discord message/modal components.
|
|
110
|
+
*/
|
|
111
|
+
export declare abstract class ODComponent<Data extends object, BuildResult> {
|
|
112
|
+
/**The id of this message/modal component. */
|
|
113
|
+
id: ODId;
|
|
114
|
+
/**The data or configuration of this message/modal component. */
|
|
115
|
+
readonly data: Data;
|
|
116
|
+
constructor(id: ODValidId, data: Data);
|
|
117
|
+
/**Build this component. Returns `null` when invalid. */
|
|
118
|
+
abstract build(): Promise<BuildResult | null> | BuildResult | null;
|
|
119
|
+
}
|
|
120
|
+
/**## ODGroupComponent `class`
|
|
121
|
+
* An Open Discord message/modal component with children.
|
|
122
|
+
*
|
|
123
|
+
* This class itself doesn't do anything, but is a blueprint for other
|
|
124
|
+
* `ODGroupComponent` classes which represent the new Discord message/modal components.
|
|
125
|
+
*/
|
|
126
|
+
export declare abstract class ODGroupComponent<Data extends object, ChildComponent extends ODComponent<object, any>, BuildResult> extends ODComponent<Data, BuildResult> {
|
|
127
|
+
/**The collection of child components. */
|
|
128
|
+
readonly children: ChildComponent[];
|
|
129
|
+
/**Add a new component to this group. There are multiple modes available:
|
|
130
|
+
* - `start`: insert at the start of the list.
|
|
131
|
+
* - `end`: insert at the end of the list.
|
|
132
|
+
* - `before`: insert before an existing component `referenceId` (`start` if `referenceId` is invalid)
|
|
133
|
+
* - `after`: insert after an existing component `referenceId` (`end` if `referenceId` is invalid)
|
|
134
|
+
* - `index`: insert at a certain index `referenceIndex` (`end` if `referenceIndex` is invalid)
|
|
135
|
+
*/
|
|
136
|
+
addComponent(c: ChildComponent, mode: "start" | "end"): void;
|
|
137
|
+
addComponent(c: ChildComponent, mode: "before" | "after", referenceId: ODValidId): void;
|
|
138
|
+
addComponent(c: ChildComponent, mode: "index", referenceIndex: number): void;
|
|
139
|
+
/**Get a component with a certain ID in this group. Returns `null` if non-existent. */
|
|
140
|
+
getComponent(id: ODValidId): ChildComponent | null;
|
|
141
|
+
/**Get the position of a component with a certain ID in this group. Returns `-1` if non-existent. */
|
|
142
|
+
getComponentPosition(id: ODValidId): number;
|
|
143
|
+
/**Returns if a component with a certain ID exists in this group. */
|
|
144
|
+
existsComponent(id: ODValidId): boolean;
|
|
145
|
+
/**Remove a component with a certain ID from this group. Returns the removed component or `null if non-existent. */
|
|
146
|
+
removeComponent(id: ODValidId): ChildComponent | null;
|
|
147
|
+
/**Moves an existing component to a new location in this group. There are multiple modes available:
|
|
148
|
+
* - `start`: move to the start of the list.
|
|
149
|
+
* - `end`: move to the end of the list.
|
|
150
|
+
* - `before`: move before an existing component `referenceId` (`start` if `referenceId` is invalid)
|
|
151
|
+
* - `after`: move after an existing component `referenceId` (`end` if `referenceId` is invalid)
|
|
152
|
+
* - `index`: move to a certain index `referenceIndex` (`end` if `referenceIndex` is invalid)
|
|
153
|
+
*/
|
|
154
|
+
moveComponent(id: ODValidId, mode: "start" | "end"): void;
|
|
155
|
+
moveComponent(id: ODValidId, mode: "before" | "after", referenceId: ODValidId): void;
|
|
156
|
+
moveComponent(id: ODValidId, mode: "index", referenceIndex: number): void;
|
|
157
|
+
}
|
|
158
|
+
/**## ODParentComponent `class`
|
|
159
|
+
* An Open Discord message/modal component with a single child.
|
|
160
|
+
*
|
|
161
|
+
* This class itself doesn't do anything, but is a blueprint for other
|
|
162
|
+
* `ODParentComponent` classes which represent the new Discord message/modal components.
|
|
163
|
+
*/
|
|
164
|
+
export declare abstract class ODParentComponent<Data extends object, ChildComponent extends ODComponent<object, any>, BuildResult> extends ODComponent<Data, BuildResult> {
|
|
165
|
+
/**The child component of this parent. */
|
|
166
|
+
private rawChild;
|
|
167
|
+
/**The child component of this parent. */
|
|
168
|
+
get child(): ChildComponent | null;
|
|
169
|
+
/**Set the child component of this parent. */
|
|
170
|
+
setComponent(c: ChildComponent | null): void;
|
|
171
|
+
}
|
|
172
|
+
/**## ODMessageComponentData `type`
|
|
173
|
+
* The configurable settings/options for the `ODMessageComponent`.
|
|
174
|
+
*/
|
|
175
|
+
export interface ODMessageComponentData {
|
|
176
|
+
/**Should the message be sent as ephemeral? */
|
|
177
|
+
ephemeral?: boolean;
|
|
178
|
+
/**Suppress/hide embeds. */
|
|
179
|
+
supressEmbeds?: boolean;
|
|
180
|
+
/**Do not send notifications to mentioned users or roles. */
|
|
181
|
+
supressNotifications?: boolean;
|
|
182
|
+
/**Additional options that aren't covered by the Open Discord api!*/
|
|
183
|
+
additionalOptions?: Omit<discord.MessageCreateOptions, "poll" | "content" | "embeds" | "components" | "files" | "flags" | "stickers">;
|
|
184
|
+
/**Add additional files which can be used in components as `attachment://...` */
|
|
185
|
+
additionalAttachments?: discord.AttachmentBuilder[];
|
|
186
|
+
}
|
|
187
|
+
/**## ODValidMessageComponents `type`
|
|
188
|
+
* A collection of all valid top-level components that can be sent in a message.
|
|
189
|
+
*/
|
|
190
|
+
export type ODValidMessageComponents = ODTextComponent | ODFileComponent | ODGalleryComponent;
|
|
191
|
+
/**## ODMessageComponentBuildResult `type`
|
|
192
|
+
* The constructed message from an `ODMessageComponent`.
|
|
193
|
+
*/
|
|
194
|
+
export interface ODMessageComponentBuildResult {
|
|
195
|
+
/**The message to send. */
|
|
196
|
+
msg: discord.MessageCreateOptions;
|
|
197
|
+
/**Is this message using Components V2? */
|
|
198
|
+
componentsV2: boolean;
|
|
199
|
+
/**Should the message be sent as ephemeral? */
|
|
200
|
+
ephemeral: boolean;
|
|
201
|
+
/**Suppress/hide embeds. */
|
|
202
|
+
supressEmbeds: boolean;
|
|
203
|
+
/**Do not send notifications to mentioned users or roles. */
|
|
204
|
+
supressNotifications: boolean;
|
|
205
|
+
/**The id of the `ODMessageComponent` this message was built with. */
|
|
206
|
+
id: ODId;
|
|
207
|
+
}
|
|
208
|
+
/**## ODMessageComponent `class`
|
|
209
|
+
* A message builder with **components v2** support.
|
|
210
|
+
* Add items to this message using `addComponent()`.
|
|
211
|
+
*
|
|
212
|
+
* Use `ODSimpleMessageComponent` for components v1, polls, embeds, etc
|
|
213
|
+
*/
|
|
214
|
+
export declare class ODMessageComponent extends ODGroupComponent<ODMessageComponentData, ODValidMessageComponents, ODMessageComponentBuildResult> {
|
|
215
|
+
constructor(id: ODValidId, data?: Partial<ODMessageComponentData>);
|
|
216
|
+
build(): Promise<{
|
|
217
|
+
id: ODId;
|
|
218
|
+
msg: {
|
|
219
|
+
nonce?: string | number;
|
|
220
|
+
forward?: discord.ForwardOptions;
|
|
221
|
+
tts?: boolean;
|
|
222
|
+
reply?: discord.ReplyOptions;
|
|
223
|
+
allowedMentions?: discord.MessageMentionOptions;
|
|
224
|
+
enforceNonce?: boolean;
|
|
225
|
+
components: discord.JSONEncodable<discord.APIMessageTopLevelComponent>[];
|
|
226
|
+
files: discord.AttachmentBuilder[];
|
|
227
|
+
};
|
|
228
|
+
componentsV2: boolean;
|
|
229
|
+
ephemeral: boolean;
|
|
230
|
+
supressEmbeds: boolean;
|
|
231
|
+
supressNotifications: boolean;
|
|
232
|
+
}>;
|
|
233
|
+
/**Enable/disable ephemeral mode. */
|
|
234
|
+
setEphemeral(value: boolean): void;
|
|
235
|
+
/**Enable supress (hide) embeds mode. */
|
|
236
|
+
setSupressEmbeds(value: boolean): void;
|
|
237
|
+
/**Enable supress (hide) notifications mode. */
|
|
238
|
+
setSupressNotifications(value: boolean): void;
|
|
239
|
+
/**Add an additional attachment which can be used in components as `attachment://...` */
|
|
240
|
+
addAdditionalAttachments(...attachments: discord.AttachmentBuilder[]): void;
|
|
241
|
+
}
|
|
242
|
+
/**## ODSimpleMessageComponentData `type`
|
|
243
|
+
* The configurable settings/options for the `ODSimpleMessageComponent`.
|
|
244
|
+
*/
|
|
245
|
+
export interface ODSimpleMessageComponentData {
|
|
246
|
+
/**Should the message be sent as ephemeral? */
|
|
247
|
+
ephemeral?: boolean;
|
|
248
|
+
/**Suppress/hide embeds. */
|
|
249
|
+
supressEmbeds?: boolean;
|
|
250
|
+
/**Do not send notifications to mentioned users or roles. */
|
|
251
|
+
supressNotifications?: boolean;
|
|
252
|
+
/**Additional options that aren't covered by the Open Discord api!*/
|
|
253
|
+
additionalOptions?: Omit<discord.MessageCreateOptions, "poll" | "content" | "embeds" | "components" | "files" | "flags">;
|
|
254
|
+
/**Add additional files which can be used in components as `attachment://...` */
|
|
255
|
+
additionalAttachments?: discord.AttachmentBuilder[];
|
|
256
|
+
}
|
|
257
|
+
/**## ODValidSimpleMessageComponents `type`
|
|
258
|
+
* A collection of all valid top-level components that can be sent in a simple message (components v1).
|
|
259
|
+
*/
|
|
260
|
+
export type ODValidSimpleMessageComponents = ODContentComponent | ODEmbedComponent | ODFileComponent | ODPollComponent;
|
|
261
|
+
/**## ODSimpleMessageComponent `class`
|
|
262
|
+
* A message builder with **components v1** support.
|
|
263
|
+
* Add items to this message using `addComponent()`.
|
|
264
|
+
*
|
|
265
|
+
* Use `ODMessageComponent` for components v2, components, containers, etc
|
|
266
|
+
*/
|
|
267
|
+
export declare class ODSimpleMessageComponent extends ODGroupComponent<ODSimpleMessageComponentData, ODValidSimpleMessageComponents, ODMessageComponentBuildResult> {
|
|
268
|
+
constructor(id: ODValidId, data?: Partial<ODMessageComponentData>);
|
|
269
|
+
build(): Promise<{
|
|
270
|
+
id: ODId;
|
|
271
|
+
msg: {
|
|
272
|
+
nonce?: string | number;
|
|
273
|
+
forward?: discord.ForwardOptions;
|
|
274
|
+
stickers?: readonly discord.StickerResolvable[];
|
|
275
|
+
tts?: boolean;
|
|
276
|
+
reply?: discord.ReplyOptions;
|
|
277
|
+
allowedMentions?: discord.MessageMentionOptions;
|
|
278
|
+
enforceNonce?: boolean;
|
|
279
|
+
content: string | undefined;
|
|
280
|
+
embeds: discord.EmbedBuilder[];
|
|
281
|
+
poll: discord.PollData | undefined;
|
|
282
|
+
files: discord.AttachmentBuilder[];
|
|
283
|
+
};
|
|
284
|
+
componentsV2: boolean;
|
|
285
|
+
ephemeral: boolean;
|
|
286
|
+
supressEmbeds: boolean;
|
|
287
|
+
supressNotifications: boolean;
|
|
288
|
+
}>;
|
|
289
|
+
/**Enable/disable ephemeral mode. */
|
|
290
|
+
setEphemeral(value: boolean): void;
|
|
291
|
+
/**Enable supress (hide) embeds mode. */
|
|
292
|
+
setSupressEmbeds(value: boolean): void;
|
|
293
|
+
/**Enable supress (hide) notifications mode. */
|
|
294
|
+
setSupressNotifications(value: boolean): void;
|
|
295
|
+
/**Add an additional attachment which can be used in components as `attachment://...` */
|
|
296
|
+
addAdditionalAttachments(...attachments: discord.AttachmentBuilder[]): void;
|
|
297
|
+
}
|
|
298
|
+
/**## ODModalComponentData `type`
|
|
299
|
+
* The configurable settings/options for the `ODModalComponent`.
|
|
300
|
+
*/
|
|
301
|
+
export interface ODModalComponentData {
|
|
302
|
+
/**The title of the modal (max 45 characters). */
|
|
303
|
+
title: string;
|
|
304
|
+
/**The custom id of this modal. */
|
|
305
|
+
customId?: string;
|
|
306
|
+
}
|
|
307
|
+
/**## ODValidModalComponents `type`
|
|
308
|
+
* A collection of all valid top-level components that can be sent in a message.
|
|
309
|
+
*/
|
|
310
|
+
export type ODValidModalComponents = ODLabelComponent | ODTextComponent;
|
|
311
|
+
/**## ODModalComponent `class`
|
|
312
|
+
* A modal builder with **components v2** support.
|
|
313
|
+
* Add questions, select menu's & labels to this modal using `addComponent()`.
|
|
314
|
+
*/
|
|
315
|
+
export declare class ODModalComponent extends ODGroupComponent<ODModalComponentData, ODValidModalComponents, discord.ModalBuilder> {
|
|
316
|
+
constructor(id: ODValidId, data?: Partial<ODModalComponentData>);
|
|
317
|
+
build(): Promise<discord.ModalBuilder>;
|
|
318
|
+
/**Set the title of the modal. */
|
|
319
|
+
setTitle(title: string): void;
|
|
320
|
+
/**Set the custom id of this modal. */
|
|
321
|
+
setCustomId(id: string | null): this;
|
|
322
|
+
}
|
|
323
|
+
/**## ODActionRowComponentData `type`
|
|
324
|
+
* The configurable settings/options for the `ODActionRowComponent`.
|
|
325
|
+
*/
|
|
326
|
+
export interface ODActionRowComponentData {
|
|
327
|
+
}
|
|
328
|
+
/**## ODValidActionRowComponents `type`
|
|
329
|
+
* A collection of all valid action row components.
|
|
330
|
+
*/
|
|
331
|
+
export type ODValidActionRowComponents = ODButtonComponent | ODDropdownComponent;
|
|
332
|
+
/**## ODActionRowComponent `class`
|
|
333
|
+
* An actionrow component which is a container for buttons, a select menu or inputs in a message or modal.
|
|
334
|
+
*/
|
|
335
|
+
export declare class ODActionRowComponent extends ODGroupComponent<ODActionRowComponentData, ODValidActionRowComponents, discord.ActionRowBuilder<discord.MessageActionRowComponentBuilder>> {
|
|
336
|
+
constructor(id: ODValidId, data?: Partial<ODActionRowComponentData>);
|
|
337
|
+
build(): Promise<discord.ActionRowBuilder<discord.MessageActionRowComponentBuilder>>;
|
|
338
|
+
}
|
|
339
|
+
/**## ODContainerComponentData `type`
|
|
340
|
+
* The configurable settings/options for the `ODContainerComponent`.
|
|
341
|
+
*/
|
|
342
|
+
export interface ODContainerComponentData {
|
|
343
|
+
/**The color of this container. */
|
|
344
|
+
color?: discord.ColorResolvable;
|
|
345
|
+
/**Mark the contents of this container as spoiler. */
|
|
346
|
+
spoiler: boolean;
|
|
347
|
+
}
|
|
348
|
+
/**## ODValidContainerComponents `type`
|
|
349
|
+
* A collection of all valid container components.
|
|
350
|
+
*/
|
|
351
|
+
export type ODValidContainerComponents = ODActionRowComponent | ODTextComponent | ODSectionComponent | ODGalleryComponent | ODSeparatorComponent | ODFileComponent;
|
|
352
|
+
/**## ODContainerComponent `class`
|
|
353
|
+
* An embed-like container for text, titles, buttons, sections, separators and other components.
|
|
354
|
+
*/
|
|
355
|
+
export declare class ODContainerComponent extends ODGroupComponent<ODContainerComponentData, ODValidContainerComponents, {
|
|
356
|
+
container: discord.ContainerBuilder;
|
|
357
|
+
attachments: discord.AttachmentBuilder[];
|
|
358
|
+
}> {
|
|
359
|
+
constructor(id: ODValidId, data?: Partial<ODContainerComponentData>);
|
|
360
|
+
build(): Promise<{
|
|
361
|
+
container: discord.ContainerBuilder;
|
|
362
|
+
attachments: discord.AttachmentBuilder[];
|
|
363
|
+
}>;
|
|
364
|
+
/**Set the accent color of this embed-like container. */
|
|
365
|
+
setColor(color: discord.ColorResolvable | null): void;
|
|
366
|
+
/**Mark the contents of this container as spoiler. */
|
|
367
|
+
setSpoiler(spoiler: boolean): void;
|
|
368
|
+
}
|
|
369
|
+
/**## ODSectionComponentData `type`
|
|
370
|
+
* The configurable settings/options for the `ODSectionComponent`.
|
|
371
|
+
*/
|
|
372
|
+
export interface ODSectionComponentData {
|
|
373
|
+
/**The accessory component shown on the right side of the section. */
|
|
374
|
+
accessory?: ODButtonComponent | ODThumbnailComponent;
|
|
375
|
+
}
|
|
376
|
+
/**## ODSectionComponent `class`
|
|
377
|
+
* A layout component that allows you to contextually associate content with an accessory component.
|
|
378
|
+
* - Components: Left
|
|
379
|
+
* - Accessory: Right
|
|
380
|
+
*/
|
|
381
|
+
export declare class ODSectionComponent extends ODGroupComponent<ODSectionComponentData, ODTextComponent, discord.SectionBuilder> {
|
|
382
|
+
constructor(id: ODValidId, data?: Partial<ODSectionComponentData>);
|
|
383
|
+
build(): Promise<discord.SectionBuilder>;
|
|
384
|
+
/**Set the accessory component shown on the right side of the section. */
|
|
385
|
+
setAccessory(accessory: ODButtonComponent | ODThumbnailComponent | null): void;
|
|
386
|
+
}
|
|
387
|
+
/**## ODLabelComponentData `type`
|
|
388
|
+
* The configurable settings/options for the `ODLabelComponent`.
|
|
389
|
+
*/
|
|
390
|
+
export interface ODLabelComponentData {
|
|
391
|
+
/**The title for the child component in the modal. */
|
|
392
|
+
title: string;
|
|
393
|
+
/**An option description for the child component in the modal. */
|
|
394
|
+
description?: string;
|
|
395
|
+
}
|
|
396
|
+
/**## ODValidLabelComponents `type`
|
|
397
|
+
* A collection of all valid label components.
|
|
398
|
+
*/
|
|
399
|
+
export type ODValidLabelComponents = ODShortInputComponent | ODParagraphInputComponent | ODDropdownComponent | ODRadioGroupComponent | ODCheckboxGroupComponent | ODCheckboxComponent | ODFileUploadComponent;
|
|
400
|
+
/**## ODLabelComponent `class`
|
|
401
|
+
* A visual separator between components. The visibility and padding of this separator can be changed.
|
|
402
|
+
*/
|
|
403
|
+
export declare class ODLabelComponent extends ODParentComponent<ODLabelComponentData, ODValidLabelComponents, discord.LabelBuilder> {
|
|
404
|
+
constructor(id: ODValidId, data: Partial<ODLabelComponentData>);
|
|
405
|
+
build(): Promise<discord.LabelBuilder>;
|
|
406
|
+
/**Set the title of the child component in the modal. */
|
|
407
|
+
setTitle(title: string): void;
|
|
408
|
+
/**Set the description of the child component in the modal. */
|
|
409
|
+
setDescription(description: string | null): void;
|
|
410
|
+
}
|
|
411
|
+
/**## ODSeparatorComponentData `type`
|
|
412
|
+
* The configurable settings/options for the `ODSeparatorComponent`.
|
|
413
|
+
*/
|
|
414
|
+
export interface ODSeparatorComponentData {
|
|
415
|
+
/**Whether a visual divider should be displayed in the component. (Default: `true`) */
|
|
416
|
+
divider: boolean;
|
|
417
|
+
/**Size of separator padding (Default: `small`) */
|
|
418
|
+
spacing: "small" | "large";
|
|
419
|
+
}
|
|
420
|
+
/**## ODSeparatorComponent `class`
|
|
421
|
+
* A visual separator between components. The visibility and padding of this separator can be changed.
|
|
422
|
+
*/
|
|
423
|
+
export declare class ODSeparatorComponent extends ODComponent<ODSeparatorComponentData, discord.SeparatorBuilder> {
|
|
424
|
+
constructor(id: ODValidId, data: Partial<ODSeparatorComponentData>);
|
|
425
|
+
build(): Promise<discord.SeparatorBuilder>;
|
|
426
|
+
/**Set whether a visual divider should be displayed in the component. (Default: `true`). */
|
|
427
|
+
setDivider(divider: boolean): void;
|
|
428
|
+
/**Set the size of separator padding (Default `small`). */
|
|
429
|
+
setSpacing(spacing: "small" | "large"): void;
|
|
430
|
+
}
|
|
431
|
+
/**## ODTextComponentData `type`
|
|
432
|
+
* The configurable settings/options for the `ODTextComponent`.
|
|
433
|
+
*/
|
|
434
|
+
export interface ODTextComponentData {
|
|
435
|
+
/**The text to display. */
|
|
436
|
+
content: string;
|
|
437
|
+
}
|
|
438
|
+
/**## ODTextComponent `class`
|
|
439
|
+
* A text component which renders markdown text in a message.
|
|
440
|
+
*/
|
|
441
|
+
export declare class ODTextComponent extends ODComponent<ODTextComponentData, discord.TextDisplayBuilder> {
|
|
442
|
+
constructor(id: ODValidId, data: Partial<ODTextComponentData>);
|
|
443
|
+
build(): Promise<discord.TextDisplayBuilder>;
|
|
444
|
+
/**Set the text to display. */
|
|
445
|
+
setContent(value: string): void;
|
|
446
|
+
}
|
|
447
|
+
/**## ODFileComponentData `type`
|
|
448
|
+
* The configurable settings/options for the `ODFileComponent`.
|
|
449
|
+
*/
|
|
450
|
+
export interface ODFileComponentData {
|
|
451
|
+
/**The name of this file. */
|
|
452
|
+
name: string;
|
|
453
|
+
/**The description of this file. */
|
|
454
|
+
description?: string;
|
|
455
|
+
/**Should this file be marked as a spoiler? */
|
|
456
|
+
spoiler?: boolean;
|
|
457
|
+
/**The binary/text contents of the file. Ignored when `externalUrl` is used. */
|
|
458
|
+
content?: discord.BufferResolvable;
|
|
459
|
+
/**A URL to an external file or image. When specified, the `content` (setContent) will be ignored. */
|
|
460
|
+
externalUrl?: string;
|
|
461
|
+
}
|
|
462
|
+
/**## ODFileComponent `class`
|
|
463
|
+
* A file component which adds a file in a message.
|
|
464
|
+
*/
|
|
465
|
+
export declare class ODFileComponent extends ODComponent<ODFileComponentData, {
|
|
466
|
+
file: discord.FileBuilder;
|
|
467
|
+
attachment: discord.AttachmentBuilder | null;
|
|
468
|
+
}> {
|
|
469
|
+
constructor(id: ODValidId, data: Partial<ODFileComponentData>);
|
|
470
|
+
build(): Promise<{
|
|
471
|
+
attachment: discord.AttachmentBuilder | null;
|
|
472
|
+
file: discord.FileBuilder;
|
|
473
|
+
}>;
|
|
474
|
+
/**Set the filename + extension. */
|
|
475
|
+
setName(value: string): void;
|
|
476
|
+
/**Set the file description. */
|
|
477
|
+
setDescription(value: string | null): void;
|
|
478
|
+
/**Set the text/binary contents of the file. */
|
|
479
|
+
setContent(value: discord.BufferResolvable | null): void;
|
|
480
|
+
/**Set a URL to an external file or image. When used, `setContent()` will be ignored! */
|
|
481
|
+
setExternalUrl(value: string | null): void;
|
|
482
|
+
/**Mark the file as spoiler. */
|
|
483
|
+
setSpoiler(value: boolean): void;
|
|
484
|
+
}
|
|
485
|
+
/**## ODGalleryComponentData `type`
|
|
486
|
+
* The configurable settings/options for the `ODGalleryComponent`.
|
|
487
|
+
*/
|
|
488
|
+
export interface ODGalleryComponentData {
|
|
489
|
+
}
|
|
490
|
+
/**## ODGalleryComponent `class`
|
|
491
|
+
* A gallery component which renders a grid of media items (images/videos) in a message.
|
|
492
|
+
* Add items to this gallery using `addComponent()`.
|
|
493
|
+
*/
|
|
494
|
+
export declare class ODGalleryComponent extends ODGroupComponent<ODGalleryComponentData, ODFileComponent, {
|
|
495
|
+
gallery: discord.MediaGalleryBuilder;
|
|
496
|
+
attachments: discord.AttachmentBuilder[];
|
|
497
|
+
}> {
|
|
498
|
+
constructor(id: ODValidId, data?: Partial<ODGalleryComponentData>);
|
|
499
|
+
build(): Promise<{
|
|
500
|
+
gallery: discord.MediaGalleryBuilder;
|
|
501
|
+
attachments: discord.AttachmentBuilder[];
|
|
502
|
+
}>;
|
|
503
|
+
}
|
|
504
|
+
/**## ODThumbnailComponentData `type`
|
|
505
|
+
* The configurable settings/options for the `ODThumbnailComponent`.
|
|
506
|
+
*/
|
|
507
|
+
export interface ODThumbnailComponentData {
|
|
508
|
+
/**The URL of the thumbnail image. Can be an external URL or `attachment://filename.ext`. */
|
|
509
|
+
url: string;
|
|
510
|
+
/**The alt text/description of the thumbnail image. */
|
|
511
|
+
description?: string;
|
|
512
|
+
/**Should this thumbnail be marked as a spoiler? */
|
|
513
|
+
spoiler?: boolean;
|
|
514
|
+
}
|
|
515
|
+
/**## ODThumbnailComponent `class`
|
|
516
|
+
* A thumbnail component which renders a small image as an accessory inside an `ODSectionComponent`.
|
|
517
|
+
* This component must be used via `ODSectionComponent.setComponent()`
|
|
518
|
+
*/
|
|
519
|
+
export declare class ODThumbnailComponent extends ODComponent<ODThumbnailComponentData, discord.ThumbnailBuilder> {
|
|
520
|
+
constructor(id: ODValidId, data: Partial<ODThumbnailComponentData>);
|
|
521
|
+
build(): Promise<discord.ThumbnailBuilder>;
|
|
522
|
+
/**Set the URL of the thumbnail image. */
|
|
523
|
+
setUrl(value: string): void;
|
|
524
|
+
/**Set the alt text/description of the thumbnail image. */
|
|
525
|
+
setDescription(value: string | null): void;
|
|
526
|
+
/**Mark the thumbnail as a spoiler. */
|
|
527
|
+
setSpoiler(value: boolean): void;
|
|
528
|
+
}
|
|
529
|
+
/**## ODContentComponentData `type`
|
|
530
|
+
* The configurable settings/options for the `ODContentComponent`.
|
|
531
|
+
*/
|
|
532
|
+
export interface ODContentComponentData {
|
|
533
|
+
/**The text to display. */
|
|
534
|
+
content: string;
|
|
535
|
+
}
|
|
536
|
+
/**## ODContentComponent `class`
|
|
537
|
+
* A text component which renders markdown text in a message without `Components V2` enabled. (Old behaviour)
|
|
538
|
+
*/
|
|
539
|
+
export declare class ODContentComponent extends ODComponent<ODContentComponentData, {
|
|
540
|
+
content: string;
|
|
541
|
+
}> {
|
|
542
|
+
constructor(id: ODValidId, data: Partial<ODContentComponentData>);
|
|
543
|
+
build(): Promise<{
|
|
544
|
+
content: string;
|
|
545
|
+
}>;
|
|
546
|
+
/**Set the text to display. */
|
|
547
|
+
setContent(value: string): void;
|
|
548
|
+
}
|
|
549
|
+
/**## ODEmbedComponentData `type`
|
|
550
|
+
* The configurable settings/options for the `ODEmbedComponent`.
|
|
551
|
+
*/
|
|
552
|
+
export interface ODEmbedComponentData {
|
|
553
|
+
/**The title of the embed. */
|
|
554
|
+
title?: string;
|
|
555
|
+
/**The color of the embed. */
|
|
556
|
+
color?: discord.ColorResolvable;
|
|
557
|
+
/**The url of the embed. */
|
|
558
|
+
url?: string;
|
|
559
|
+
/**The description of the embed. */
|
|
560
|
+
description?: string;
|
|
561
|
+
/**The author text of the embed. */
|
|
562
|
+
authorText?: string;
|
|
563
|
+
/**The author image of the embed. */
|
|
564
|
+
authorImage?: string;
|
|
565
|
+
/**The author url of the embed. */
|
|
566
|
+
authorUrl?: string;
|
|
567
|
+
/**The footer text of the embed. */
|
|
568
|
+
footerText?: string;
|
|
569
|
+
/**The footer image of the embed. */
|
|
570
|
+
footerImage?: string;
|
|
571
|
+
/**The image of the embed. */
|
|
572
|
+
image?: string;
|
|
573
|
+
/**The thumbnail of the embed. */
|
|
574
|
+
thumbnail?: string;
|
|
575
|
+
/**The fields of the embed. */
|
|
576
|
+
fields?: ODInterfaceWithPartialProperty<discord.EmbedField, "inline">[];
|
|
577
|
+
/**The timestamp of the embed. */
|
|
578
|
+
timestamp?: number | Date;
|
|
579
|
+
}
|
|
580
|
+
/**## ODEmbedComponent `class`
|
|
581
|
+
* An embed component which renders an embed in a message without `Components V2` enabled. (Old behaviour)
|
|
582
|
+
*/
|
|
583
|
+
export declare class ODEmbedComponent extends ODComponent<ODEmbedComponentData, discord.EmbedBuilder> {
|
|
584
|
+
constructor(id: ODValidId, data: Partial<ODEmbedComponentData>);
|
|
585
|
+
build(): Promise<discord.EmbedBuilder>;
|
|
586
|
+
/**Set the title of this embed */
|
|
587
|
+
setTitle(title: string | null): this;
|
|
588
|
+
/**Set the color of this embed */
|
|
589
|
+
setColor(color: discord.ColorResolvable | null): this;
|
|
590
|
+
/**Set the url of this embed */
|
|
591
|
+
setUrl(url: string | null): this;
|
|
592
|
+
/**Set the description of this embed */
|
|
593
|
+
setDescription(description: string | null): this;
|
|
594
|
+
/**Set the author of this embed */
|
|
595
|
+
setAuthor(text: string | null, image?: string | null, url?: string | null): this;
|
|
596
|
+
/**Set the footer of this embed */
|
|
597
|
+
setFooter(text: string | null, image?: string | null): this;
|
|
598
|
+
/**Set the image of this embed */
|
|
599
|
+
setImage(image: string | null): this;
|
|
600
|
+
/**Set the thumbnail of this embed */
|
|
601
|
+
setThumbnail(thumbnail: string | null): this;
|
|
602
|
+
/**Set the fields of this embed */
|
|
603
|
+
setFields(fields: ODInterfaceWithPartialProperty<discord.EmbedField, "inline">[]): this;
|
|
604
|
+
/**Add fields to this embed */
|
|
605
|
+
addFields(...fields: ODInterfaceWithPartialProperty<discord.EmbedField, "inline">[]): this;
|
|
606
|
+
/**Clear all fields from this embed */
|
|
607
|
+
clearFields(): this;
|
|
608
|
+
/**Set the timestamp of this embed. When set to `true`, the current timestamp is used. */
|
|
609
|
+
setTimestamp(timestamp: number | Date | true | null): this;
|
|
610
|
+
}
|
|
611
|
+
/**## ODPollComponentData `type`
|
|
612
|
+
* The configurable settings/options for the `ODPollComponent`.
|
|
613
|
+
*/
|
|
614
|
+
export interface ODPollComponentData {
|
|
615
|
+
/**The poll question. */
|
|
616
|
+
question: string;
|
|
617
|
+
/**The duration of the poll in hours. */
|
|
618
|
+
durationHours: number;
|
|
619
|
+
/**Available poll answers. */
|
|
620
|
+
answers: discord.PollAnswerData[];
|
|
621
|
+
/**Allow selecting multiple answers. */
|
|
622
|
+
allowMultiSelect: boolean;
|
|
623
|
+
}
|
|
624
|
+
/**## ODPollComponent `class`
|
|
625
|
+
* A poll component which adds a poll to a message without `Components V2` enabled. (Old behaviour)
|
|
626
|
+
*/
|
|
627
|
+
export declare class ODPollComponent extends ODComponent<ODPollComponentData, discord.PollData> {
|
|
628
|
+
constructor(id: ODValidId, data: Partial<ODPollComponentData>);
|
|
629
|
+
build(): Promise<{
|
|
630
|
+
layoutType: discord.PollLayoutType;
|
|
631
|
+
allowMultiselect: boolean;
|
|
632
|
+
duration: number;
|
|
633
|
+
question: {
|
|
634
|
+
text: string;
|
|
635
|
+
};
|
|
636
|
+
answers: discord.PollAnswerData[];
|
|
637
|
+
}>;
|
|
638
|
+
/**Set the poll question. */
|
|
639
|
+
setQuestion(question: string): void;
|
|
640
|
+
/**Set the poll duration in hours. */
|
|
641
|
+
setDurationHours(duration: number): void;
|
|
642
|
+
/**Allow selecting multiple answers. */
|
|
643
|
+
setMultiSelect(multi: boolean): void;
|
|
644
|
+
/**Set the poll answers. */
|
|
645
|
+
setAnswers(answers: discord.PollAnswerData[]): void;
|
|
646
|
+
/**Add additional poll answers. */
|
|
647
|
+
addAnswers(...answers: discord.PollAnswerData[]): void;
|
|
648
|
+
}
|
|
649
|
+
/**## ODButtonComponentData `type`
|
|
650
|
+
* The configurable settings/options for the `ODButtonComponent`.
|
|
651
|
+
*/
|
|
652
|
+
export interface ODButtonComponentData {
|
|
653
|
+
/**The custom id of this button. Ignored when `url` is specified. */
|
|
654
|
+
customId?: string;
|
|
655
|
+
/**The url of this button. Disables interactions & customId */
|
|
656
|
+
url?: string;
|
|
657
|
+
/**The button color. Ignored when `url` is specified. */
|
|
658
|
+
color: ODValidButtonColor;
|
|
659
|
+
/**The button label */
|
|
660
|
+
label?: string;
|
|
661
|
+
/**The button emoji */
|
|
662
|
+
emoji?: string;
|
|
663
|
+
/**Is the button disabled? */
|
|
664
|
+
disabled: boolean;
|
|
665
|
+
}
|
|
666
|
+
/**## ODButtonComponent `class`
|
|
667
|
+
* A button component which renders an interactive button inside the message.
|
|
668
|
+
* A reply can be sent using Open Discord responders.
|
|
669
|
+
*/
|
|
670
|
+
export declare class ODButtonComponent extends ODComponent<ODButtonComponentData, discord.ButtonBuilder> {
|
|
671
|
+
constructor(id: ODValidId, data: Partial<ODButtonComponentData>);
|
|
672
|
+
build(): Promise<discord.ButtonBuilder>;
|
|
673
|
+
/**Get the `discord.ButtonStyle` for the specified `ODValidButtonColor` */
|
|
674
|
+
protected getButtonStyle(): discord.ButtonStyle;
|
|
675
|
+
/**Set the custom id of this button. Ignored when `setUrl()` is used. */
|
|
676
|
+
setCustomId(id: string | null): this;
|
|
677
|
+
/**Set the url of this button. */
|
|
678
|
+
setUrl(url: string | null): this;
|
|
679
|
+
/**Set the color of this button. Ignored when `setUrl()` is used. */
|
|
680
|
+
setColor(color: ODValidButtonColor): this;
|
|
681
|
+
/**Set the label of this button. */
|
|
682
|
+
setLabel(label: string | null): this;
|
|
683
|
+
/**Set the emoji of this button. */
|
|
684
|
+
setEmoji(emoji: string | null): this;
|
|
685
|
+
/**Disable this button. */
|
|
686
|
+
setDisabled(disabled: boolean): this;
|
|
687
|
+
}
|
|
688
|
+
/**## ODShortInputComponentData `type`
|
|
689
|
+
* The configurable settings/options for the `ODShortInputComponent`.
|
|
690
|
+
*/
|
|
691
|
+
export interface ODShortInputComponentData {
|
|
692
|
+
/**The custom id of this modal text input. */
|
|
693
|
+
customId?: string;
|
|
694
|
+
/**The min length of this modal text input. */
|
|
695
|
+
minLength?: number;
|
|
696
|
+
/**The max length of this modal text input. */
|
|
697
|
+
maxLength?: number;
|
|
698
|
+
/**Is this modal text input required? */
|
|
699
|
+
required: boolean;
|
|
700
|
+
/**The placeholder of this modal text input. */
|
|
701
|
+
placeholder?: string;
|
|
702
|
+
/**The initial value of this modal text input. */
|
|
703
|
+
initialValue?: string;
|
|
704
|
+
}
|
|
705
|
+
/**## ODShortInputComponent `class`
|
|
706
|
+
* A short text input component for modals.
|
|
707
|
+
* It must be placed inside an `ODLabelComponent`.
|
|
708
|
+
*/
|
|
709
|
+
export declare class ODShortInputComponent extends ODComponent<ODShortInputComponentData, discord.TextInputBuilder> {
|
|
710
|
+
constructor(id: ODValidId, data: Partial<ODShortInputComponentData>);
|
|
711
|
+
build(): Promise<discord.TextInputBuilder>;
|
|
712
|
+
/**Set the custom id of this modal text input. */
|
|
713
|
+
setCustomId(id: string | null): this;
|
|
714
|
+
/**Set the minimum amount of characters of this modal text input. */
|
|
715
|
+
setMinLength(length: number | null): this;
|
|
716
|
+
/**Set the maximum amount of characters of this modal text input. */
|
|
717
|
+
setMaxLength(length: number | null): this;
|
|
718
|
+
/**Set the placeholder of this modal text input. */
|
|
719
|
+
setPlaceholder(placeholder: string | null): this;
|
|
720
|
+
/**Set the initial value of this modal text input. */
|
|
721
|
+
setInitialValue(initialValue: string | null): this;
|
|
722
|
+
/**Mark this modal text input as required. */
|
|
723
|
+
setRequired(required: boolean): this;
|
|
724
|
+
}
|
|
725
|
+
/**## ODParagraphInputComponentData `type`
|
|
726
|
+
* The configurable settings/options for the `ODParagraphInputComponent`.
|
|
727
|
+
*/
|
|
728
|
+
export interface ODParagraphInputComponentData {
|
|
729
|
+
/**The custom id of this modal text input. */
|
|
730
|
+
customId?: string;
|
|
731
|
+
/**The min length of this modal text input. */
|
|
732
|
+
minLength?: number;
|
|
733
|
+
/**The max length of this modal text input. */
|
|
734
|
+
maxLength?: number;
|
|
735
|
+
/**Is this modal text input required? */
|
|
736
|
+
required: boolean;
|
|
737
|
+
/**The placeholder of this modal text input. */
|
|
738
|
+
placeholder?: string;
|
|
739
|
+
/**The initial value of this modal text input. */
|
|
740
|
+
initialValue?: string;
|
|
741
|
+
}
|
|
742
|
+
/**## ODParagraphInputComponent `class`
|
|
743
|
+
* A paragraph text input component for modals.
|
|
744
|
+
* It must be placed inside an `ODLabelComponent`.
|
|
745
|
+
*/
|
|
746
|
+
export declare class ODParagraphInputComponent extends ODComponent<ODParagraphInputComponentData, discord.TextInputBuilder> {
|
|
747
|
+
constructor(id: ODValidId, data: Partial<ODParagraphInputComponentData>);
|
|
748
|
+
build(): Promise<discord.TextInputBuilder>;
|
|
749
|
+
/**Set the custom id of this modal text input. */
|
|
750
|
+
setCustomId(id: string | null): this;
|
|
751
|
+
/**Set the minimum amount of characters of this modal text input. */
|
|
752
|
+
setMinLength(length: number | null): this;
|
|
753
|
+
/**Set the maximum amount of characters of this modal text input. */
|
|
754
|
+
setMaxLength(length: number | null): this;
|
|
755
|
+
/**Set the placeholder of this modal text input. */
|
|
756
|
+
setPlaceholder(placeholder: string | null): this;
|
|
757
|
+
/**Set the initial value of this modal text input. */
|
|
758
|
+
setInitialValue(initialValue: string | null): this;
|
|
759
|
+
/**Mark this modal text input as required. */
|
|
760
|
+
setRequired(required: boolean): this;
|
|
761
|
+
}
|
|
762
|
+
/**## ODDropdownComponentData `type`
|
|
763
|
+
* The configurable settings/options for the `ODDropdownComponent`.
|
|
764
|
+
*/
|
|
765
|
+
export interface ODDropdownComponentData {
|
|
766
|
+
/**The type of this dropdown. */
|
|
767
|
+
type: "string" | "role" | "channel" | "user" | "mentionable";
|
|
768
|
+
/**The custom id of this dropdown. */
|
|
769
|
+
customId?: string;
|
|
770
|
+
/**The placeholder of this dropdown. */
|
|
771
|
+
placeholder?: string;
|
|
772
|
+
/**The minimum amount of items to be selected in this dropdown. */
|
|
773
|
+
minValues?: number;
|
|
774
|
+
/**The maximum amount of items to be selected in this dropdown. */
|
|
775
|
+
maxValues?: number;
|
|
776
|
+
/**Is this dropdown disabled? */
|
|
777
|
+
disabled?: boolean;
|
|
778
|
+
/**Allowed channel types when the type is "channel" */
|
|
779
|
+
channelTypes?: discord.ChannelType[];
|
|
780
|
+
/**The options when the type is "string" */
|
|
781
|
+
options?: discord.SelectMenuComponentOptionData[];
|
|
782
|
+
/**The options when the type is "user" */
|
|
783
|
+
users?: discord.User[];
|
|
784
|
+
/**The options when the type is "role" */
|
|
785
|
+
roles?: discord.Role[];
|
|
786
|
+
/**The options when the type is "channel" */
|
|
787
|
+
channels?: discord.Channel[];
|
|
788
|
+
/**The options when the type is "mentionable" */
|
|
789
|
+
mentionables?: (discord.User | discord.Role)[];
|
|
790
|
+
}
|
|
791
|
+
/**## ODDropdownComponent `class`
|
|
792
|
+
* A dropdown component which renders an interactive dropdown inside the message/modal.
|
|
793
|
+
* A reply can be sent using Open Discord responders.
|
|
794
|
+
*/
|
|
795
|
+
export declare class ODDropdownComponent extends ODComponent<ODDropdownComponentData, discord.BaseSelectMenuBuilder<discord.APISelectMenuComponent>> {
|
|
796
|
+
constructor(id: ODValidId, data: Partial<ODDropdownComponentData>);
|
|
797
|
+
build(): Promise<discord.StringSelectMenuBuilder | discord.UserSelectMenuBuilder | discord.RoleSelectMenuBuilder | discord.MentionableSelectMenuBuilder | discord.ChannelSelectMenuBuilder>;
|
|
798
|
+
/**Set the custom id of this dropdown. */
|
|
799
|
+
setCustomId(id: string | null): this;
|
|
800
|
+
/**Set the type of this dropdown. */
|
|
801
|
+
setType(type: "string" | "role" | "channel" | "user" | "mentionable"): this;
|
|
802
|
+
/**Set the minimum selection amount of this dropdown. */
|
|
803
|
+
setMinValues(amount: number | null): this;
|
|
804
|
+
/**Set the maximum selection amount of this dropdown. */
|
|
805
|
+
setMaxValues(amount: number | null): this;
|
|
806
|
+
/**Set the placeholder of this dropdown. */
|
|
807
|
+
setPlaceholder(placeholder: string | null): this;
|
|
808
|
+
/**Disable this dropdown. */
|
|
809
|
+
setDisabled(disabled: boolean): this;
|
|
810
|
+
/**Set the available channel types of this dropdown. */
|
|
811
|
+
setChannelTypes(channelTypes: discord.ChannelType[]): this;
|
|
812
|
+
/**Set the options of this dropdown (when `type == "string"`) */
|
|
813
|
+
setOptions(options: discord.SelectMenuComponentOptionData[]): this;
|
|
814
|
+
/**Set the users of this dropdown (when `type == "user"`) */
|
|
815
|
+
setUsers(users: discord.User[]): this;
|
|
816
|
+
/**Set the roles of this dropdown (when `type == "role"`) */
|
|
817
|
+
setRoles(roles: discord.Role[]): this;
|
|
818
|
+
/**Set the channels of this dropdown (when `type == "channel"`) */
|
|
819
|
+
setChannels(channels: discord.Channel[]): this;
|
|
820
|
+
/**Set the mentionables of this dropdown (when `type == "mentionable"`) */
|
|
821
|
+
setMentionables(mentionables: (discord.User | discord.Role)[]): this;
|
|
822
|
+
}
|
|
823
|
+
/**## ODRadioGroupComponentData `type`
|
|
824
|
+
* The configurable settings/options for the `ODRadioGroupComponent`.
|
|
825
|
+
*/
|
|
826
|
+
export interface ODRadioGroupComponentData {
|
|
827
|
+
/**The custom id of this radio group. */
|
|
828
|
+
customId?: string;
|
|
829
|
+
/**Is this radio group required? (At least one option must be selected) */
|
|
830
|
+
required: boolean;
|
|
831
|
+
/**The available radio options. (min 2, max 10) */
|
|
832
|
+
options: discord.APIRadioGroupOption[];
|
|
833
|
+
}
|
|
834
|
+
/**## ODRadioGroupComponent `class`
|
|
835
|
+
* A radio group component which renders an interactive radio group input inside a modal.
|
|
836
|
+
*/
|
|
837
|
+
export declare class ODRadioGroupComponent extends ODComponent<ODRadioGroupComponentData, discord.RadioGroupBuilder> {
|
|
838
|
+
constructor(id: ODValidId, data: Partial<ODRadioGroupComponentData>);
|
|
839
|
+
build(): Promise<discord.RadioGroupBuilder>;
|
|
840
|
+
/**Set the custom id of this radio group. */
|
|
841
|
+
setCustomId(id: string | null): this;
|
|
842
|
+
/**Mark this radio group as required (At least one option must be selected). */
|
|
843
|
+
setRequired(required: boolean): this;
|
|
844
|
+
/**Set the available radio options (min 2, max 10) */
|
|
845
|
+
setOptions(options: discord.APIRadioGroupOption[]): this;
|
|
846
|
+
}
|
|
847
|
+
/**## ODCheckboxGroupComponentData `type`
|
|
848
|
+
* The configurable settings/options for the `ODCheckboxGroupComponent`.
|
|
849
|
+
*/
|
|
850
|
+
export interface ODCheckboxGroupComponentData {
|
|
851
|
+
/**The custom id of this checkbox group. */
|
|
852
|
+
customId?: string;
|
|
853
|
+
/**Is this checkbox group required? (At least one option must be selected) */
|
|
854
|
+
required: boolean;
|
|
855
|
+
/**The available checkbox options. (min 1, max 10) */
|
|
856
|
+
options: discord.APICheckboxGroupOption[];
|
|
857
|
+
/**The minimum amount of checkboxes to be selected. */
|
|
858
|
+
minValues?: number;
|
|
859
|
+
/**The maximum amount of checkboxes to be selected. */
|
|
860
|
+
maxValues?: number;
|
|
861
|
+
}
|
|
862
|
+
/**## ODCheckboxGroupComponent `class`
|
|
863
|
+
* A checkbox group component which renders an interactive checkbox group input inside a modal.
|
|
864
|
+
*/
|
|
865
|
+
export declare class ODCheckboxGroupComponent extends ODComponent<ODCheckboxGroupComponentData, discord.CheckboxGroupBuilder> {
|
|
866
|
+
constructor(id: ODValidId, data: Partial<ODCheckboxGroupComponentData>);
|
|
867
|
+
build(): Promise<discord.CheckboxGroupBuilder>;
|
|
868
|
+
/**Set the custom id of this checkbox group. */
|
|
869
|
+
setCustomId(id: string | null): this;
|
|
870
|
+
/**Mark this checkbox group as required (At least one option must be selected). */
|
|
871
|
+
setRequired(required: boolean): this;
|
|
872
|
+
/**Set the available checkbox options (min 2, max 10) */
|
|
873
|
+
setOptions(options: discord.APICheckboxGroupOption[]): this;
|
|
874
|
+
/**Set the minimum amount of selected checkboxes. */
|
|
875
|
+
setMinValues(amount: number | null): this;
|
|
876
|
+
/**Set the maximum amount of selected checkboxes. */
|
|
877
|
+
setMaxValues(amount: number | null): this;
|
|
878
|
+
}
|
|
879
|
+
/**## ODCheckboxComponentData `type`
|
|
880
|
+
* The configurable settings/options for the `ODCheckboxComponent`.
|
|
881
|
+
*/
|
|
882
|
+
export interface ODCheckboxComponentData {
|
|
883
|
+
/**The custom id of this checkbox. */
|
|
884
|
+
customId?: string;
|
|
885
|
+
/**Is this checkbox enabled by default? */
|
|
886
|
+
default: boolean;
|
|
887
|
+
}
|
|
888
|
+
/**## ODCheckboxComponent `class`
|
|
889
|
+
* A checkbox component which renders an interactive checkbox input inside a modal.
|
|
890
|
+
* The label & description should be set via an `ODLabelComponent`
|
|
891
|
+
*/
|
|
892
|
+
export declare class ODCheckboxComponent extends ODComponent<ODCheckboxComponentData, discord.CheckboxBuilder> {
|
|
893
|
+
constructor(id: ODValidId, data: Partial<ODCheckboxComponentData>);
|
|
894
|
+
build(): Promise<discord.CheckboxBuilder>;
|
|
895
|
+
/**Set the custom id of this checkbox. */
|
|
896
|
+
setCustomId(id: string | null): this;
|
|
897
|
+
/**Mark this checkbox as enabled by default. */
|
|
898
|
+
setDefault(enabledByDefault: boolean): this;
|
|
899
|
+
}
|
|
900
|
+
/**## ODFileUploadComponentData `type`
|
|
901
|
+
* The configurable settings/options for the `ODFileUploadComponent`.
|
|
902
|
+
*/
|
|
903
|
+
export interface ODFileUploadComponentData {
|
|
904
|
+
/**The custom id of this file upload. */
|
|
905
|
+
customId?: string;
|
|
906
|
+
/**Is this file upload required? */
|
|
907
|
+
required: boolean;
|
|
908
|
+
/**The minimum amount of files to upload (0-10). */
|
|
909
|
+
minAmount?: number;
|
|
910
|
+
/**The maximum amount of files to upload (1-10). */
|
|
911
|
+
maxAmount?: number;
|
|
912
|
+
}
|
|
913
|
+
/**## ODFileUploadComponent `class`
|
|
914
|
+
* A file upload component which allows users to upload one or multiple files inside a modal.
|
|
915
|
+
* The label & description should be set via an `ODLabelComponent`
|
|
916
|
+
*/
|
|
917
|
+
export declare class ODFileUploadComponent extends ODComponent<ODFileUploadComponentData, discord.FileUploadBuilder> {
|
|
918
|
+
constructor(id: ODValidId, data: Partial<ODFileUploadComponentData>);
|
|
919
|
+
build(): Promise<discord.FileUploadBuilder>;
|
|
920
|
+
/**Set the custom id of this dropdown. */
|
|
921
|
+
setCustomId(id: string | null): this;
|
|
922
|
+
/**Mark this file upload as required. */
|
|
923
|
+
setRequired(required: boolean): this;
|
|
924
|
+
/**Set the minimum amount of files to upload (0-10). */
|
|
925
|
+
setMinAmount(amount: number | null): this;
|
|
926
|
+
/**Set the maximum amount of files to upload (1-10). */
|
|
927
|
+
setMaxAmount(amount: number | null): this;
|
|
928
|
+
}
|