@open-discord-bots/framework 0.3.7 → 0.3.9

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/main.js CHANGED
@@ -44,7 +44,7 @@ export class ODMain {
44
44
  constructor(managers, project) {
45
45
  this.project = project;
46
46
  this.versions = managers.versions;
47
- this.versions.add(ODVersion.fromString("opendiscord:api", "v0.3.7"));
47
+ this.versions.add(ODVersion.fromString("opendiscord:api", "v0.3.9"));
48
48
  this.versions.add(ODVersion.fromString("opendiscord:livestatus", "v2.0.0"));
49
49
  this.debugfile = managers.debugfile;
50
50
  this.console = managers.console;
@@ -614,6 +614,8 @@ export declare class ODMessageInstance {
614
614
  export declare class ODMessage<Origin extends string, Params, WorkerIds extends string = string> extends ODBuilderImplementation<ODMessageInstance, Origin, Params, ODMessageBuildResult, WorkerIds> {
615
615
  /**Build this message & compile it for discord.js */
616
616
  build(origin: Origin, params: Params): Promise<ODMessageBuildResult>;
617
+ /**Duplicate this message. Warning: If workers access external variables (outside parameters), the clone will still use those variables. This might result in unexpected behaviour! */
618
+ duplicate(newId?: ODValidId): ODMessage<Origin, Params, WorkerIds>;
617
619
  }
618
620
  /**## ODQuickMessage `class`
619
621
  * This is an Open Discord quick message builder.
@@ -1244,6 +1244,14 @@ export class ODMessage extends ODBuilderImplementation {
1244
1244
  this.didCache = true;
1245
1245
  return result;
1246
1246
  }
1247
+ /**Duplicate this message. Warning: If workers access external variables (outside parameters), the clone will still use those variables. This might result in unexpected behaviour! */
1248
+ duplicate(newId) {
1249
+ const newMessage = new ODMessage(newId ?? this.id.value);
1250
+ for (const worker of this.workers.getAll()) {
1251
+ newMessage.workers.add(worker.duplicate());
1252
+ }
1253
+ return newMessage;
1254
+ }
1247
1255
  }
1248
1256
  /**## ODQuickMessage `class`
1249
1257
  * This is an Open Discord quick message builder.
@@ -1,7 +1,8 @@
1
1
  import { ODId, ODValidId, ODManagerData, ODNoGeneric, ODManager, ODValidButtonColor, ODInterfaceWithPartialProperty } from "./base.js";
2
2
  import * as discord from "discord.js";
3
- import { ODWorkerManager, ODWorkerCallback } from "./worker.js";
3
+ import { ODWorkerManager, ODWorkerCallback, ODWorker } from "./worker.js";
4
4
  import { ODDebugger } from "./console.js";
5
+ import { ODMessage, ODMessageInstance } from "./builder.js";
5
6
  /**## ODComponentFactoryInstance `class`
6
7
  * An Open Discord component factory instance.
7
8
  *
@@ -28,6 +29,8 @@ export declare class ODComponentFactory<Component extends ODComponent<object, an
28
29
  constructor(id: ODValidId, callback?: ODWorkerCallback<ODComponentFactoryInstance<Component>, Origin, Params>, priority?: number, callbackId?: ODValidId);
29
30
  /**Run all workers and return the resulting component. */
30
31
  build(origin: Origin, params: Params): Promise<ODComponentInferBuildResult<Component>>;
32
+ /**Duplicate this component factory. Warning: If workers access external variables (outside parameters), the clone will still use those variables. This might result in unexpected behaviour! */
33
+ duplicate(newId?: ODValidId): ODComponentFactory<Component, Origin, Params, WorkerIds>;
31
34
  }
32
35
  /**## ODComponentManagerIdConstraint `type`
33
36
  * The constraint/layout for id mappings/interfaces of the `ODComponentManager` class.
@@ -54,6 +57,26 @@ export declare class ODBaseComponentManager<IdList extends ODComponentManagerIdC
54
57
  exists(id: keyof ODNoGeneric<IdList>): boolean;
55
58
  exists(id: ODValidId): boolean;
56
59
  }
60
+ /**## ODComponentModifierManagerIdConstraint `type`
61
+ * The constraint/layout for id mappings/interfaces of the `ODComponentModifierManager` class.
62
+ */
63
+ export type ODComponentModifierManagerIdConstraint = Record<string, ODMessageComponentModifier<string, {}>>;
64
+ /**## ODComponentModifierManager `class`
65
+ * An Open Discord component modifier manager.
66
+ *
67
+ * It contains a collection of all `ODMessageComponentModifier`'s. You can:
68
+ * - Patch, modify, expand or update existing messages
69
+ * - It Does not affect the original message (cloned)
70
+ */
71
+ export declare class ODComponentModifierManager<IdList extends ODComponentModifierManagerIdConstraint = ODComponentModifierManagerIdConstraint> extends ODManager<ODMessageComponentModifier<string, {}>> {
72
+ constructor(debug: ODDebugger);
73
+ get<ModifierId extends keyof ODNoGeneric<IdList>>(id: ModifierId): IdList[ModifierId];
74
+ get(id: ODValidId): ODMessageComponentModifier<string, {}> | null;
75
+ remove<ModifierId extends keyof ODNoGeneric<IdList>>(id: ModifierId): IdList[ModifierId];
76
+ remove(id: ODValidId): ODMessageComponentModifier<string, {}> | null;
77
+ exists(id: keyof ODNoGeneric<IdList>): boolean;
78
+ exists(id: ODValidId): boolean;
79
+ }
57
80
  /**## ODSharedComponentManager `class
58
81
  * A special class with types for shared message/modal `ODComponent`'s.
59
82
  * Create button, dropdown or any other layout component template to use them in messages & modals.
@@ -89,31 +112,67 @@ export declare class ODModalComponentManager<IdList extends ODComponentManagerId
89
112
  * - Get to know the origin of the request (e.g. button, dropdown, modal, ...)
90
113
  * - And so much more!
91
114
  */
92
- export declare class ODComponentManager<SharedIdList extends ODComponentManagerIdConstraint = ODComponentManagerIdConstraint, MessageIdList extends ODComponentManagerIdConstraint = ODComponentManagerIdConstraint, ModalIdList extends ODComponentManagerIdConstraint = ODComponentManagerIdConstraint> {
115
+ export declare class ODComponentManager<SharedIdList extends ODComponentManagerIdConstraint = ODComponentManagerIdConstraint, MessageIdList extends ODComponentManagerIdConstraint = ODComponentManagerIdConstraint, ModalIdList extends ODComponentManagerIdConstraint = ODComponentManagerIdConstraint, ModifierIdList extends ODComponentModifierManagerIdConstraint = ODComponentModifierManagerIdConstraint> {
93
116
  /**The manager for all shared components. */
94
117
  shared: ODSharedComponentManager<SharedIdList>;
95
118
  /**The manager for all messages components. */
96
119
  messages: ODMessageComponentManager<MessageIdList>;
97
120
  /**The manager for all modals components. */
98
121
  modals: ODModalComponentManager<ModalIdList>;
122
+ /**The collection of all component modifiers. */
123
+ modifiers: ODComponentModifierManager<ModifierIdList>;
99
124
  constructor(debug: ODDebugger);
100
125
  }
101
126
  /**## ODComponentInferBuildResult `type`
102
127
  * Infer the build result of a certain component.
103
128
  */
104
129
  export type ODComponentInferBuildResult<Component> = Component extends ODComponent<object, infer BuildResult> ? BuildResult : never;
130
+ /**## ODComponentType `type`
131
+ * The type of an `ODComponent`.
132
+ */
133
+ export type ODComponentType = "message" | "simple-message" | "modal" | "action-row" | "container" | "section" | "label" | "separator" | "text" | "file" | "gallery" | "thumbnail" | "simple-content" | "simple-embed" | "simple-poll" | "button" | "short-input" | "paragraph-input" | "dropdown" | "radio-group" | "checkbox-group" | "checkbox" | "file-upload";
134
+ /**## ODComponentType `type`
135
+ * Get the `ODComponent` class for a specific `ODComponentType`.
136
+ */
137
+ export interface ODComponentForType {
138
+ "message": ODMessageComponent;
139
+ "simple-message": ODSimpleMessageComponent;
140
+ "modal": ODModalComponent;
141
+ "action-row": ODActionRowComponent;
142
+ "container": ODContainerComponent;
143
+ "section": ODSectionComponent;
144
+ "label": ODLabelComponent;
145
+ "separator": ODSeparatorComponent;
146
+ "text": ODTextComponent;
147
+ "file": ODFileComponent;
148
+ "gallery": ODGalleryComponent;
149
+ "thumbnail": ODThumbnailComponent;
150
+ "simple-content": ODContentComponent;
151
+ "simple-embed": ODEmbedComponent;
152
+ "simple-poll": ODPollComponent;
153
+ "button": ODButtonComponent;
154
+ "short-input": ODShortInputComponent;
155
+ "paragraph-input": ODParagraphInputComponent;
156
+ "dropdown": ODDropdownComponent;
157
+ "radio-group": ODRadioGroupComponent;
158
+ "checkbox-group": ODCheckboxGroupComponent;
159
+ "checkbox": ODCheckboxComponent;
160
+ "file-upload": ODFileUploadComponent;
161
+ }
105
162
  /**## ODComponent `class`
106
163
  * An Open Discord message/modal component.
107
164
  *
108
165
  * This class itself doesn't do anything, but is a blueprint for other
109
166
  * `ODComponent` classes which represent the new Discord message/modal components.
110
167
  */
111
- export declare abstract class ODComponent<Data extends object, BuildResult> {
168
+ export declare abstract class ODComponent<Data extends object, BuildResult, Type extends ODComponentType = ODComponentType> {
112
169
  /**The id of this message/modal component. */
113
170
  id: ODId;
114
171
  /**The data or configuration of this message/modal component. */
115
172
  readonly data: Data;
116
- constructor(id: ODValidId, data: Data);
173
+ /**The type of this component. */
174
+ readonly type: Type;
175
+ constructor(id: ODValidId, type: Type, data: Data);
117
176
  /**Build this component. Returns `null` when invalid. */
118
177
  abstract build(): Promise<BuildResult | null> | BuildResult | null;
119
178
  }
@@ -125,7 +184,7 @@ export declare abstract class ODComponent<Data extends object, BuildResult> {
125
184
  */
126
185
  export declare abstract class ODGroupComponent<Data extends object, ChildComponent extends ODComponent<object, any>, BuildResult> extends ODComponent<Data, BuildResult> {
127
186
  /**The collection of child components. */
128
- readonly children: ChildComponent[];
187
+ children: ChildComponent[];
129
188
  /**Add a new component to this group. There are multiple modes available:
130
189
  * - `start`: insert at the start of the list.
131
190
  * - `end`: insert at the end of the list.
@@ -136,14 +195,22 @@ export declare abstract class ODGroupComponent<Data extends object, ChildCompone
136
195
  addComponent(c: ChildComponent, mode: "start" | "end"): void;
137
196
  addComponent(c: ChildComponent, mode: "before" | "after", referenceId: ODValidId): void;
138
197
  addComponent(c: ChildComponent, mode: "index", referenceIndex: number): void;
139
- /**Get a component with a certain ID in this group. Returns `null` if non-existent. */
198
+ /**Get a component with a certain ID in this group. Returns `null` if non-existent. Also able to search for components recursively. */
140
199
  getComponent(id: ODValidId): ChildComponent | null;
200
+ getComponent(id: ODValidId, recursive: true, recursiveLimit?: number): ODComponent<any, any, ODComponentType> | null;
201
+ /**Get all components of a certain type in this group. Also able to search for components recursively. */
202
+ getComponentsOfType<Type extends ODComponentType>(type: Type): ODComponentForType[Type][];
203
+ getComponentsOfType<Type extends ODComponentType>(type: Type, recursive: true, recursiveLimit?: number): ODComponentForType[Type][];
141
204
  /**Get the position of a component with a certain ID in this group. Returns `-1` if non-existent. */
142
205
  getComponentPosition(id: ODValidId): number;
206
+ /**List all child components of this group. */
207
+ listComponent(): ChildComponent[];
143
208
  /**Returns if a component with a certain ID exists in this group. */
144
209
  existsComponent(id: ODValidId): boolean;
145
210
  /**Remove a component with a certain ID from this group. Returns the removed component or `null if non-existent. */
146
211
  removeComponent(id: ODValidId): ChildComponent | null;
212
+ /**Remove all child components from this group. Returns the removed components. */
213
+ clearComponents(): ChildComponent[];
147
214
  /**Moves an existing component to a new location in this group. There are multiple modes available:
148
215
  * - `start`: move to the start of the list.
149
216
  * - `end`: move to the end of the list.
@@ -169,6 +236,22 @@ export declare abstract class ODParentComponent<Data extends object, ChildCompon
169
236
  /**Set the child component of this parent. */
170
237
  setComponent(c: ChildComponent | null): void;
171
238
  }
239
+ /**## ODMessageComponentModifier `class`
240
+ * This is an Open Discord message component modifier.
241
+ *
242
+ * It contains a worker which is can be added to a message.
243
+ *
244
+ * The original message is preserved and a duplicate of `ODMessage` or `ODComponentFactory` is returned.
245
+ *
246
+ * Warning: If workers access external variables (outside parameters), the clone will still use those variables. This might result in unexpected behaviour!
247
+ */
248
+ export declare class ODMessageComponentModifier<Origin extends string, Params> extends ODManagerData {
249
+ /**The worker which will modify the message. */
250
+ worker: ODWorker<ODMessageInstance | ODComponentFactoryInstance<ODMessageComponent>, Origin, Params>;
251
+ constructor(id: ODValidId, worker: ODWorker<ODMessageInstance | ODComponentFactoryInstance<ODMessageComponent>, Origin, Params>);
252
+ /**Modify an `ODMessage` or `ODComponentFactory` with the worker. A copy will be returned and the original is preserved. */
253
+ modify<Message extends ODMessage<any, any, any> | ODComponentFactory<ODMessageComponent, any, any, any>>(message: Message): Message;
254
+ }
172
255
  /**## ODMessageComponentData `type`
173
256
  * The configurable settings/options for the `ODMessageComponent`.
174
257
  */
@@ -187,7 +270,7 @@ export interface ODMessageComponentData {
187
270
  /**## ODValidMessageComponents `type`
188
271
  * A collection of all valid top-level components that can be sent in a message.
189
272
  */
190
- export type ODValidMessageComponents = ODTextComponent | ODFileComponent | ODGalleryComponent;
273
+ export type ODValidMessageComponents = ODTextComponent | ODFileComponent | ODGalleryComponent | ODActionRowComponent | ODContainerComponent | ODSectionComponent | ODSeparatorComponent;
191
274
  /**## ODMessageComponentBuildResult `type`
192
275
  * The constructed message from an `ODMessageComponent`.
193
276
  */
@@ -46,6 +46,14 @@ export class ODComponentFactory extends ODManagerData {
46
46
  throw new ODSystemError("ODComponentFactory.build() --> Failed to build component! (id: " + this.id.value + ")");
47
47
  return rootComponent.build();
48
48
  }
49
+ /**Duplicate this component factory. Warning: If workers access external variables (outside parameters), the clone will still use those variables. This might result in unexpected behaviour! */
50
+ duplicate(newId) {
51
+ const newMessage = new ODComponentFactory(newId ?? this.id.value);
52
+ for (const worker of this.workers.getAll()) {
53
+ newMessage.workers.add(worker.duplicate());
54
+ }
55
+ return newMessage;
56
+ }
49
57
  }
50
58
  /**## ODBaseComponentManager `class`
51
59
  * A generic Open Discord component manager.
@@ -67,6 +75,27 @@ export class ODBaseComponentManager extends ODManager {
67
75
  return super.exists(id);
68
76
  }
69
77
  }
78
+ /**## ODComponentModifierManager `class`
79
+ * An Open Discord component modifier manager.
80
+ *
81
+ * It contains a collection of all `ODMessageComponentModifier`'s. You can:
82
+ * - Patch, modify, expand or update existing messages
83
+ * - It Does not affect the original message (cloned)
84
+ */
85
+ export class ODComponentModifierManager extends ODManager {
86
+ constructor(debug) {
87
+ super(debug, "component modifier");
88
+ }
89
+ get(id) {
90
+ return super.get(id);
91
+ }
92
+ remove(id) {
93
+ return super.remove(id);
94
+ }
95
+ exists(id) {
96
+ return super.exists(id);
97
+ }
98
+ }
70
99
  /**## ODSharedComponentManager `class
71
100
  * A special class with types for shared message/modal `ODComponent`'s.
72
101
  * Create button, dropdown or any other layout component template to use them in messages & modals.
@@ -115,10 +144,13 @@ export class ODComponentManager {
115
144
  messages;
116
145
  /**The manager for all modals components. */
117
146
  modals;
147
+ /**The collection of all component modifiers. */
148
+ modifiers;
118
149
  constructor(debug) {
119
150
  this.shared = new ODSharedComponentManager(debug);
120
151
  this.messages = new ODMessageComponentManager(debug);
121
152
  this.modals = new ODModalComponentManager(debug);
153
+ this.modifiers = new ODComponentModifierManager(debug);
122
154
  }
123
155
  }
124
156
  /**## ODComponent `class`
@@ -132,9 +164,12 @@ export class ODComponent {
132
164
  id;
133
165
  /**The data or configuration of this message/modal component. */
134
166
  data;
135
- constructor(id, data) {
167
+ /**The type of this component. */
168
+ type;
169
+ constructor(id, type, data) {
136
170
  this.id = new ODId(id);
137
171
  this.data = data;
172
+ this.type = type;
138
173
  }
139
174
  }
140
175
  /**## ODGroupComponent `class`
@@ -175,15 +210,56 @@ export class ODGroupComponent extends ODComponent {
175
210
  }
176
211
  }
177
212
  }
178
- /**Get a component with a certain ID in this group. Returns `null` if non-existent. */
179
- getComponent(id) {
213
+ getComponent(id, recursive, recursiveLimit = 15) {
180
214
  const component = this.children.find((c) => c.id.value === new ODId(id).value);
181
- return component ?? null;
215
+ if (component)
216
+ return component;
217
+ else if (recursive && (recursiveLimit > 0)) {
218
+ for (const child of this.children) {
219
+ if (child instanceof ODGroupComponent) {
220
+ const finalComponent = child.getComponent(id, recursive, recursiveLimit - 1);
221
+ if (finalComponent)
222
+ return finalComponent;
223
+ }
224
+ else if (child instanceof ODParentComponent) {
225
+ const finalComponent = child.child;
226
+ if (finalComponent.id.value === new ODId(id).value)
227
+ return finalComponent;
228
+ }
229
+ }
230
+ return null;
231
+ }
232
+ else
233
+ return null;
234
+ }
235
+ getComponentsOfType(type, recursive, recursiveLimit = 15) {
236
+ if (recursive && (recursiveLimit > 0)) {
237
+ const finalComponents = [...this.children.filter((c) => c.type === type)];
238
+ for (const child of this.children) {
239
+ if (child instanceof ODGroupComponent) {
240
+ finalComponents.push(...child.getComponentsOfType(type, recursive, recursiveLimit - 1));
241
+ }
242
+ else if (child instanceof ODParentComponent) {
243
+ const finalComponent = child.child;
244
+ if (finalComponent.type === type)
245
+ finalComponents.push(finalComponent);
246
+ }
247
+ }
248
+ return finalComponents;
249
+ }
250
+ else {
251
+ const finalComponents = [...this.children.filter((c) => c.type === type)];
252
+ return finalComponents;
253
+ }
182
254
  }
183
255
  /**Get the position of a component with a certain ID in this group. Returns `-1` if non-existent. */
184
256
  getComponentPosition(id) {
185
257
  return this.children.findIndex((c) => c.id.value === new ODId(id).value);
186
258
  }
259
+ /**List all child components of this group. */
260
+ listComponent() {
261
+ return this.children;
262
+ }
187
263
  /**Returns if a component with a certain ID exists in this group. */
188
264
  existsComponent(id) {
189
265
  const component = this.children.find((c) => c.id.value === new ODId(id).value);
@@ -197,6 +273,12 @@ export class ODGroupComponent extends ODComponent {
197
273
  else
198
274
  return this.children.splice(index, 1)[0];
199
275
  }
276
+ /**Remove all child components from this group. Returns the removed components. */
277
+ clearComponents() {
278
+ const removedChildren = this.children;
279
+ this.children = [];
280
+ return removedChildren;
281
+ }
200
282
  moveComponent(id, mode = "start", reference) {
201
283
  const component = this.removeComponent(id);
202
284
  if (component) {
@@ -228,6 +310,32 @@ export class ODParentComponent extends ODComponent {
228
310
  this.rawChild = c;
229
311
  }
230
312
  }
313
+ /////////////////////////////
314
+ // COMPONENT MODIFIERS //
315
+ /////////////////////////////
316
+ /**## ODMessageComponentModifier `class`
317
+ * This is an Open Discord message component modifier.
318
+ *
319
+ * It contains a worker which is can be added to a message.
320
+ *
321
+ * The original message is preserved and a duplicate of `ODMessage` or `ODComponentFactory` is returned.
322
+ *
323
+ * Warning: If workers access external variables (outside parameters), the clone will still use those variables. This might result in unexpected behaviour!
324
+ */
325
+ export class ODMessageComponentModifier extends ODManagerData {
326
+ /**The worker which will modify the message. */
327
+ worker;
328
+ constructor(id, worker) {
329
+ super(id);
330
+ this.worker = worker;
331
+ }
332
+ /**Modify an `ODMessage` or `ODComponentFactory` with the worker. A copy will be returned and the original is preserved. */
333
+ modify(message) {
334
+ const newMsg = message.duplicate(message.id.value + "-VERIFYBAR");
335
+ newMsg.workers.add(this.worker.duplicate());
336
+ return newMsg;
337
+ }
338
+ }
231
339
  /**## ODMessageComponent `class`
232
340
  * A message builder with **components v2** support.
233
341
  * Add items to this message using `addComponent()`.
@@ -237,7 +345,7 @@ export class ODParentComponent extends ODComponent {
237
345
  export class ODMessageComponent extends ODGroupComponent {
238
346
  constructor(id, data) {
239
347
  const initData = { ...data };
240
- super(id, initData);
348
+ super(id, "message", initData);
241
349
  }
242
350
  async build() {
243
351
  if (this.children.length < 1)
@@ -261,6 +369,14 @@ export class ODMessageComponent extends ODGroupComponent {
261
369
  if (res?.attachments)
262
370
  attachments.push(...res.attachments);
263
371
  }
372
+ else if (component instanceof ODContainerComponent) {
373
+ //ODContainerComponent (special)
374
+ const res = await component.build();
375
+ if (res)
376
+ components.push(res.container);
377
+ if (res?.attachments)
378
+ attachments.push(...res.attachments);
379
+ }
264
380
  else {
265
381
  //general ODComponent's
266
382
  const res = await component.build();
@@ -309,7 +425,7 @@ export class ODMessageComponent extends ODGroupComponent {
309
425
  export class ODSimpleMessageComponent extends ODGroupComponent {
310
426
  constructor(id, data) {
311
427
  const initData = { ...data };
312
- super(id, initData);
428
+ super(id, "simple-message", initData);
313
429
  }
314
430
  async build() {
315
431
  if (this.children.length < 1)
@@ -385,7 +501,7 @@ export class ODSimpleMessageComponent extends ODGroupComponent {
385
501
  export class ODModalComponent extends ODGroupComponent {
386
502
  constructor(id, data) {
387
503
  const initData = { title: "<empty>", ...data };
388
- super(id, initData);
504
+ super(id, "modal", initData);
389
505
  }
390
506
  async build() {
391
507
  if (this.children.length < 1)
@@ -429,7 +545,7 @@ export class ODModalComponent extends ODGroupComponent {
429
545
  export class ODActionRowComponent extends ODGroupComponent {
430
546
  constructor(id, data) {
431
547
  const initData = { ...data };
432
- super(id, initData);
548
+ super(id, "action-row", initData);
433
549
  }
434
550
  async build() {
435
551
  if (this.children.length < 1)
@@ -452,7 +568,7 @@ export class ODActionRowComponent extends ODGroupComponent {
452
568
  export class ODContainerComponent extends ODGroupComponent {
453
569
  constructor(id, data) {
454
570
  const initData = { spoiler: false, ...data };
455
- super(id, initData);
571
+ super(id, "container", initData);
456
572
  }
457
573
  async build() {
458
574
  if (this.children.length < 1)
@@ -509,7 +625,7 @@ export class ODContainerComponent extends ODGroupComponent {
509
625
  export class ODSectionComponent extends ODGroupComponent {
510
626
  constructor(id, data) {
511
627
  const initData = { ...data };
512
- super(id, initData);
628
+ super(id, "section", initData);
513
629
  }
514
630
  async build() {
515
631
  if (this.children.length < 1)
@@ -542,7 +658,7 @@ export class ODSectionComponent extends ODGroupComponent {
542
658
  export class ODLabelComponent extends ODParentComponent {
543
659
  constructor(id, data) {
544
660
  const initData = { title: "<empty>", ...data };
545
- super(id, initData);
661
+ super(id, "label", initData);
546
662
  }
547
663
  async build() {
548
664
  let component = undefined;
@@ -572,7 +688,7 @@ export class ODLabelComponent extends ODParentComponent {
572
688
  export class ODSeparatorComponent extends ODComponent {
573
689
  constructor(id, data) {
574
690
  const initData = { divider: true, spacing: "small", ...data };
575
- super(id, initData);
691
+ super(id, "separator", initData);
576
692
  }
577
693
  async build() {
578
694
  return new discord.SeparatorBuilder({
@@ -595,7 +711,7 @@ export class ODSeparatorComponent extends ODComponent {
595
711
  export class ODTextComponent extends ODComponent {
596
712
  constructor(id, data) {
597
713
  const initData = { content: "", ...data };
598
- super(id, initData);
714
+ super(id, "text", initData);
599
715
  }
600
716
  async build() {
601
717
  if (this.data.content.length < 1)
@@ -615,7 +731,7 @@ export class ODTextComponent extends ODComponent {
615
731
  export class ODFileComponent extends ODComponent {
616
732
  constructor(id, data) {
617
733
  const initData = { name: "file.txt", ...data };
618
- super(id, initData);
734
+ super(id, "file", initData);
619
735
  }
620
736
  async build() {
621
737
  if (!this.data.content && !this.data.externalUrl)
@@ -662,7 +778,7 @@ export class ODFileComponent extends ODComponent {
662
778
  export class ODGalleryComponent extends ODGroupComponent {
663
779
  constructor(id, data) {
664
780
  const initData = { ...data };
665
- super(id, initData);
781
+ super(id, "gallery", initData);
666
782
  }
667
783
  async build() {
668
784
  if (this.children.length < 1)
@@ -695,7 +811,7 @@ export class ODGalleryComponent extends ODGroupComponent {
695
811
  export class ODThumbnailComponent extends ODComponent {
696
812
  constructor(id, data) {
697
813
  const initData = { url: "", ...data };
698
- super(id, initData);
814
+ super(id, "thumbnail", initData);
699
815
  }
700
816
  async build() {
701
817
  if (this.data.url.length < 1)
@@ -725,7 +841,7 @@ export class ODThumbnailComponent extends ODComponent {
725
841
  export class ODContentComponent extends ODComponent {
726
842
  constructor(id, data) {
727
843
  const initData = { content: "", ...data };
728
- super(id, initData);
844
+ super(id, "simple-content", initData);
729
845
  }
730
846
  async build() {
731
847
  if (this.data.content.length < 1)
@@ -745,7 +861,7 @@ export class ODContentComponent extends ODComponent {
745
861
  export class ODEmbedComponent extends ODComponent {
746
862
  constructor(id, data) {
747
863
  const initData = { ...data };
748
- super(id, initData);
864
+ super(id, "simple-embed", initData);
749
865
  }
750
866
  async build() {
751
867
  if (this.data.title && this.data.title.length > 256)
@@ -871,7 +987,7 @@ export class ODEmbedComponent extends ODComponent {
871
987
  export class ODPollComponent extends ODComponent {
872
988
  constructor(id, data) {
873
989
  const initData = { question: "<empty>", durationHours: 1, allowMultiSelect: false, answers: [], ...data };
874
- super(id, initData);
990
+ super(id, "simple-poll", initData);
875
991
  }
876
992
  async build() {
877
993
  if (this.data.question.length < 1)
@@ -914,7 +1030,7 @@ export class ODPollComponent extends ODComponent {
914
1030
  export class ODButtonComponent extends ODComponent {
915
1031
  constructor(id, data) {
916
1032
  const initData = { color: "gray", disabled: false, ...data };
917
- super(id, initData);
1033
+ super(id, "button", initData);
918
1034
  }
919
1035
  async build() {
920
1036
  if (!this.data.emoji && !this.data.label)
@@ -981,7 +1097,7 @@ export class ODButtonComponent extends ODComponent {
981
1097
  export class ODShortInputComponent extends ODComponent {
982
1098
  constructor(id, data) {
983
1099
  const initData = { required: false, ...data };
984
- super(id, initData);
1100
+ super(id, "short-input", initData);
985
1101
  }
986
1102
  async build() {
987
1103
  return new discord.TextInputBuilder({
@@ -1032,7 +1148,7 @@ export class ODShortInputComponent extends ODComponent {
1032
1148
  export class ODParagraphInputComponent extends ODComponent {
1033
1149
  constructor(id, data) {
1034
1150
  const initData = { required: false, ...data };
1035
- super(id, initData);
1151
+ super(id, "paragraph-input", initData);
1036
1152
  }
1037
1153
  async build() {
1038
1154
  return new discord.TextInputBuilder({
@@ -1083,7 +1199,7 @@ export class ODParagraphInputComponent extends ODComponent {
1083
1199
  export class ODDropdownComponent extends ODComponent {
1084
1200
  constructor(id, data) {
1085
1201
  const initData = { type: "string", ...data };
1086
- super(id, initData);
1202
+ super(id, "dropdown", initData);
1087
1203
  }
1088
1204
  async build() {
1089
1205
  const genericOpts = {
@@ -1204,7 +1320,7 @@ export class ODDropdownComponent extends ODComponent {
1204
1320
  export class ODRadioGroupComponent extends ODComponent {
1205
1321
  constructor(id, data) {
1206
1322
  const initData = { required: false, options: [], ...data };
1207
- super(id, initData);
1323
+ super(id, "radio-group", initData);
1208
1324
  }
1209
1325
  async build() {
1210
1326
  if (!this.data.options || this.data.options.length < 2)
@@ -1237,7 +1353,7 @@ export class ODRadioGroupComponent extends ODComponent {
1237
1353
  export class ODCheckboxGroupComponent extends ODComponent {
1238
1354
  constructor(id, data) {
1239
1355
  const initData = { required: false, options: [], ...data };
1240
- super(id, initData);
1356
+ super(id, "checkbox-group", initData);
1241
1357
  }
1242
1358
  async build() {
1243
1359
  if (!this.data.options || this.data.options.length < 2)
@@ -1283,7 +1399,7 @@ export class ODCheckboxGroupComponent extends ODComponent {
1283
1399
  export class ODCheckboxComponent extends ODComponent {
1284
1400
  constructor(id, data) {
1285
1401
  const initData = { default: false, ...data };
1286
- super(id, initData);
1402
+ super(id, "checkbox", initData);
1287
1403
  }
1288
1404
  async build() {
1289
1405
  return new discord.CheckboxBuilder({
@@ -1309,7 +1425,7 @@ export class ODCheckboxComponent extends ODComponent {
1309
1425
  export class ODFileUploadComponent extends ODComponent {
1310
1426
  constructor(id, data) {
1311
1427
  const initData = { required: false, ...data };
1312
- super(id, initData);
1428
+ super(id, "file-upload", initData);
1313
1429
  }
1314
1430
  async build() {
1315
1431
  if (typeof this.data.minAmount == "number" && !(this.data.minAmount >= 0 && this.data.minAmount <= 10))
@@ -158,6 +158,8 @@ export interface ODSharedFuseList {
158
158
  messageComponentsLoading: boolean;
159
159
  /**Load the default Open Discord modal components. */
160
160
  modalComponentsLoading: boolean;
161
+ /**Load the default Open Discord component modifiers. */
162
+ componentModifiersLoading: boolean;
161
163
  /**Load the default Open Discord command responders. */
162
164
  commandRespondersLoading: boolean;
163
165
  /**Load the default Open Discord button responders. */
@@ -90,6 +90,7 @@ export class ODSharedFuseManager extends ODFuseManager {
90
90
  sharedComponentsLoading: true,
91
91
  messageComponentsLoading: true,
92
92
  modalComponentsLoading: true,
93
+ componentModifiersLoading: true,
93
94
  commandRespondersLoading: true,
94
95
  buttonRespondersLoading: true,
95
96
  dropdownRespondersLoading: true,