oopscord.js 0.0.25 → 0.0.27

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.
Files changed (39) hide show
  1. package/bun.lock +264 -0
  2. package/dist/structures/Constants.d.ts +2 -0
  3. package/dist/structures/Constants.d.ts.map +1 -1
  4. package/dist/structures/Constants.js +1 -0
  5. package/dist/structures/DiscordApp.d.ts +79 -2
  6. package/dist/structures/DiscordApp.d.ts.map +1 -1
  7. package/dist/structures/DiscordApp.js +215 -56
  8. package/dist/structures/components/BaseButton.d.ts +35 -1
  9. package/dist/structures/components/BaseButton.d.ts.map +1 -1
  10. package/dist/structures/components/BaseButton.js +70 -24
  11. package/dist/structures/components/BaseModal.d.ts +104 -6
  12. package/dist/structures/components/BaseModal.d.ts.map +1 -1
  13. package/dist/structures/components/BaseModal.js +161 -28
  14. package/dist/structures/components/BaseSelectMenu.d.ts +73 -3
  15. package/dist/structures/components/BaseSelectMenu.d.ts.map +1 -1
  16. package/dist/structures/components/BaseSelectMenu.js +117 -47
  17. package/dist/structures/decorators/Constants.d.ts +2 -0
  18. package/dist/structures/decorators/Constants.d.ts.map +1 -1
  19. package/dist/structures/decorators/Constants.js +3 -1
  20. package/dist/structures/decorators/DiscordModuleDecorator.d.ts +27 -0
  21. package/dist/structures/decorators/DiscordModuleDecorator.d.ts.map +1 -1
  22. package/dist/structures/decorators/DiscordModuleDecorator.js +27 -0
  23. package/dist/structures/decorators/MessageComponentDecorator.d.ts +73 -6
  24. package/dist/structures/decorators/MessageComponentDecorator.d.ts.map +1 -1
  25. package/dist/structures/decorators/MessageComponentDecorator.js +71 -3
  26. package/dist/utils/Util.d.ts +3 -0
  27. package/dist/utils/Util.d.ts.map +1 -1
  28. package/dist/utils/Util.js +15 -2
  29. package/package.json +4 -3
  30. package/dist/structures/Client.d.ts +0 -6
  31. package/dist/structures/Client.d.ts.map +0 -1
  32. package/dist/structures/Client.js +0 -43
  33. package/dist/structures/decorators/DiscordModule.d.ts +0 -20
  34. package/dist/structures/decorators/DiscordModule.d.ts.map +0 -1
  35. package/dist/structures/decorators/DiscordModule.js +0 -56
  36. package/dist/utils/InteractionUtil.d.ts +0 -5
  37. package/dist/utils/InteractionUtil.d.ts.map +0 -1
  38. package/dist/utils/InteractionUtil.js +0 -10
  39. package/tsconfig.json +0 -110
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ModuleType = exports.MODAL_SELECT_MENU_VALUE_INDEX_KEY = exports.MODAL_TEXT_INPUT_VALUE_INDEX_KEY = exports.MODAL_COMPONENTS_KEY = exports.MODAL_OPTIONS_KEY = exports.SELECT_MENU_OPTIONS_KEY = exports.SELECT_MENU_TYPE_KEY = exports.BUTTON_OPTIONS_KEY = exports.MESSAGE_COMPONENT_MODULE_COMPONENTS_KEY = exports.DISCORD_MODULE_EXTERNAL_EVENTS_KEY = exports.DISCORD_MODULE_INTERNAL_EVENTS_KEY = exports.DICSORD_MODULE_OPTIONS_KEY = exports.OPTIONS_PARAMETER_INDEX_KEY = exports.CONTEXT_MENU_TYPE_KEY = exports.COMMAND_SUBCOMMANDS_KEY = exports.COMMAND_SUBCOMMAND_GROUPS_KEY = exports.COMMAND_OPTIONS_KEY = exports.COMMAND_PRIVATE_GUILD_KEY = exports.COMMAND_PRIVATE_KEY = exports.COMMAND_DESCRIPTION_KEY = exports.COMMAND_NAME_KEY = exports.INTERACTION_TYPE_KEY = exports.INTERACTION_PARAMETER_INDEX_KEY = exports.INTERACTION_RUN_METHOD_KEY = exports.INTERACTION_INTEGRATION_TYPES_KEY = exports.COMMAND_MODULE_COMMANDS_KEY = exports.MODULE_TYPE_KEY = void 0;
3
+ exports.ModuleType = exports.MODAL_FILE_UPLOAD_VALUE_INDEX_KEY = exports.MODAL_SELECT_MENU_VALUE_INDEX_KEY = exports.MODAL_TEXT_INPUT_VALUE_INDEX_KEY = exports.MODAL_COMPONENTS_KEY = exports.MODAL_OPTIONS_KEY = exports.SELECT_MENU_VALUES_INDEX_KEY = exports.SELECT_MENU_OPTIONS_KEY = exports.SELECT_MENU_TYPE_KEY = exports.BUTTON_OPTIONS_KEY = exports.MESSAGE_COMPONENT_MODULE_COMPONENTS_KEY = exports.DISCORD_MODULE_EXTERNAL_EVENTS_KEY = exports.DISCORD_MODULE_INTERNAL_EVENTS_KEY = exports.DICSORD_MODULE_OPTIONS_KEY = exports.OPTIONS_PARAMETER_INDEX_KEY = exports.CONTEXT_MENU_TYPE_KEY = exports.COMMAND_SUBCOMMANDS_KEY = exports.COMMAND_SUBCOMMAND_GROUPS_KEY = exports.COMMAND_OPTIONS_KEY = exports.COMMAND_PRIVATE_GUILD_KEY = exports.COMMAND_PRIVATE_KEY = exports.COMMAND_DESCRIPTION_KEY = exports.COMMAND_NAME_KEY = exports.INTERACTION_TYPE_KEY = exports.INTERACTION_PARAMETER_INDEX_KEY = exports.INTERACTION_RUN_METHOD_KEY = exports.INTERACTION_INTEGRATION_TYPES_KEY = exports.COMMAND_MODULE_COMMANDS_KEY = exports.MODULE_TYPE_KEY = void 0;
4
4
  exports.MODULE_TYPE_KEY = Symbol("type");
5
5
  exports.COMMAND_MODULE_COMMANDS_KEY = Symbol("commands");
6
6
  exports.INTERACTION_INTEGRATION_TYPES_KEY = Symbol("integration_types");
@@ -23,10 +23,12 @@ exports.MESSAGE_COMPONENT_MODULE_COMPONENTS_KEY = Symbol("components");
23
23
  exports.BUTTON_OPTIONS_KEY = Symbol("options");
24
24
  exports.SELECT_MENU_TYPE_KEY = Symbol("type");
25
25
  exports.SELECT_MENU_OPTIONS_KEY = Symbol("options");
26
+ exports.SELECT_MENU_VALUES_INDEX_KEY = Symbol("values_index");
26
27
  exports.MODAL_OPTIONS_KEY = Symbol("options");
27
28
  exports.MODAL_COMPONENTS_KEY = Symbol("components");
28
29
  exports.MODAL_TEXT_INPUT_VALUE_INDEX_KEY = Symbol("field_index");
29
30
  exports.MODAL_SELECT_MENU_VALUE_INDEX_KEY = Symbol("field_index");
31
+ exports.MODAL_FILE_UPLOAD_VALUE_INDEX_KEY = Symbol("field_index");
30
32
  var ModuleType;
31
33
  (function (ModuleType) {
32
34
  ModuleType[ModuleType["COMMAND"] = 0] = "COMMAND";
@@ -8,11 +8,38 @@ export interface ModuleOptions extends ClientOptions {
8
8
  };
9
9
  disableCache?: boolean;
10
10
  }
11
+ /**
12
+ * Default configuration options for Discord modules.
13
+ */
11
14
  export declare const defaultModuleOptions: ModuleOptions;
12
15
  export interface DiscordModuleEvents {
13
16
  eventName: keyof ClientEvents;
14
17
  methodName: string;
15
18
  }
19
+ /**
20
+ * Decorator that marks a class as a Discord module.
21
+ *
22
+ * @param option1 - The configuration options for the module
23
+ * @returns A decorator function that applies module metadata to the target class
24
+ *
25
+ * @throws {TypeError} If any of the imported modules are not valid Discord modules
26
+ */
16
27
  export declare function DiscordModule(option1: ModuleOptions): <TFunction extends Function>(constructor: TFunction) => void;
28
+ /**
29
+ * Decorator that registers a method as an event handler for a Discord client event.
30
+ *
31
+ * @param eventName - The name of the Discord client event to listen for
32
+ * @returns A method decorator that registers the decorated method as an event handler
33
+ *
34
+ * @example
35
+ * ```typescript
36
+ * class MyModule {
37
+ * @EventHandler('messageCreate')
38
+ * onMessageCreate(message: Message) {
39
+ * // Handle message creation
40
+ * }
41
+ * }
42
+ * ```
43
+ */
17
44
  export declare function EventHandler(eventName: keyof ClientEvents): MethodDecorator;
18
45
  //# sourceMappingURL=DiscordModuleDecorator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DiscordModuleDecorator.d.ts","sourceRoot":"","sources":["../../../src/structures/decorators/DiscordModuleDecorator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAGzD,MAAM,WAAW,aAAc,SAAQ,aAAa;IAChD,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,CAAC,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC,EAAE,CAAC;IACzC,IAAI,CAAC,EAAE;QACH,MAAM,EAAE,OAAO,CAAC;QAChB,KAAK,EAAE,IAAI,GAAG,MAAM,CAAA;KACvB,CAAC;IACF,YAAY,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,eAAO,MAAM,oBAAoB,EAAE,aASlC,CAAA;AAED,MAAM,WAAW,mBAAmB;IAChC,SAAS,EAAE,MAAM,YAAY,CAAC;IAC9B,UAAU,EAAE,MAAM,CAAC;CACtB;AAQD,wBAAgB,aAAa,CAAC,OAAO,EAAE,aAAa,IAChC,SAAS,SAAS,QAAQ,EAAE,aAAa,SAAS,UASrE;AAED,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,YAAY,GAAG,eAAe,CAQ3E"}
1
+ {"version":3,"file":"DiscordModuleDecorator.d.ts","sourceRoot":"","sources":["../../../src/structures/decorators/DiscordModuleDecorator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAGzD,MAAM,WAAW,aAAc,SAAQ,aAAa;IAChD,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,CAAC,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC,EAAE,CAAC;IACzC,IAAI,CAAC,EAAE;QACH,MAAM,EAAE,OAAO,CAAC;QAChB,KAAK,EAAE,IAAI,GAAG,MAAM,CAAA;KACvB,CAAC;IACF,YAAY,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,aASlC,CAAA;AAED,MAAM,WAAW,mBAAmB;IAChC,SAAS,EAAE,MAAM,YAAY,CAAC;IAC9B,UAAU,EAAE,MAAM,CAAC;CACtB;AAQD;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,aAAa,IAChC,SAAS,SAAS,QAAQ,EAAE,aAAa,SAAS,UASrE;AAGD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,YAAY,GAAG,eAAe,CAQ3E"}
@@ -4,6 +4,9 @@ exports.defaultModuleOptions = void 0;
4
4
  exports.DiscordModule = DiscordModule;
5
5
  exports.EventHandler = EventHandler;
6
6
  const Constants_1 = require("./Constants");
7
+ /**
8
+ * Default configuration options for Discord modules.
9
+ */
7
10
  exports.defaultModuleOptions = {
8
11
  token: "",
9
12
  imports: [],
@@ -19,6 +22,14 @@ exports.defaultModuleOptions = {
19
22
  // methodName: string;
20
23
  // eventEmitter: EventEmitter;
21
24
  // }
25
+ /**
26
+ * Decorator that marks a class as a Discord module.
27
+ *
28
+ * @param option1 - The configuration options for the module
29
+ * @returns A decorator function that applies module metadata to the target class
30
+ *
31
+ * @throws {TypeError} If any of the imported modules are not valid Discord modules
32
+ */
22
33
  function DiscordModule(option1) {
23
34
  return function (constructor) {
24
35
  const options = mergeDefault(exports.defaultModuleOptions, option1);
@@ -29,6 +40,22 @@ function DiscordModule(option1) {
29
40
  Reflect.defineMetadata(Constants_1.DICSORD_MODULE_OPTIONS_KEY, options, constructor);
30
41
  };
31
42
  }
43
+ /**
44
+ * Decorator that registers a method as an event handler for a Discord client event.
45
+ *
46
+ * @param eventName - The name of the Discord client event to listen for
47
+ * @returns A method decorator that registers the decorated method as an event handler
48
+ *
49
+ * @example
50
+ * ```typescript
51
+ * class MyModule {
52
+ * @EventHandler('messageCreate')
53
+ * onMessageCreate(message: Message) {
54
+ * // Handle message creation
55
+ * }
56
+ * }
57
+ * ```
58
+ */
32
59
  function EventHandler(eventName) {
33
60
  return function (target, propertyKey, propertyDescriptor) {
34
61
  const events = Reflect.getMetadata(Constants_1.DISCORD_MODULE_INTERNAL_EVENTS_KEY, target.constructor) ?? [];
@@ -1,4 +1,4 @@
1
- import { ActionRowBuilder, ComponentEmojiResolvable, LabelBuilder, ModalActionRowComponentBuilder, TextDisplayBuilder } from "discord.js";
1
+ import { ComponentEmojiResolvable, LabelBuilder, TextDisplayBuilder } from "discord.js";
2
2
  import { ButtonStyle, ChannelType, TextInputStyle } from "discord-api-types/v10";
3
3
  type DistributiveOmit<T, K extends keyof T> = T extends unknown ? Omit<T, K> : never;
4
4
  export type ButtonOptions = InteractionButtonOptions | LinkButtonOptions | PremiumButtonOptions;
@@ -53,6 +53,18 @@ export type MentionableSelectMenuOptions = BaseSelectMenuOptions & {
53
53
  defaultUsers?: string[];
54
54
  defaultRoles?: string[];
55
55
  };
56
+ export type ModalLabelComponentData = {
57
+ customId: string;
58
+ component: LabelBuilder;
59
+ outerType: "label";
60
+ innerType: "string_select" | "user_select" | "channel_select" | "role_select" | "mentionable_select" | "text_input" | "file_upload" | "radio_group" | "checkbox_group" | "checkbox";
61
+ };
62
+ export type ModalTextDisplayComponentData = {
63
+ customId: string;
64
+ component: TextDisplayBuilder;
65
+ outerType: "text_display";
66
+ };
67
+ export type ModalComponentData = ModalLabelComponentData | ModalTextDisplayComponentData;
56
68
  export type ModalOptions = {
57
69
  customId: string;
58
70
  title: string;
@@ -82,23 +94,54 @@ export type ModalRoleSelect = RoleSelectMenuOptions & {
82
94
  export type ModalMentionableSelect = MentionableSelectMenuOptions & {
83
95
  type: "mentionable_select";
84
96
  };
85
- export type ModalFileUploadOptions = {
97
+ export type ModalFileUpload = {
86
98
  type: "file_upload";
87
99
  customId: string;
88
100
  minValues?: number;
89
101
  maxValues?: number;
90
102
  required?: boolean;
91
103
  };
92
- export type ModalTextDisplayOptions = {
104
+ export type ModalRadioGroup = {
105
+ type: "radio_group";
106
+ customId: string;
107
+ options: {
108
+ label: string;
109
+ value: string;
110
+ description?: string;
111
+ default?: boolean;
112
+ }[];
113
+ required?: boolean;
114
+ };
115
+ export type ModalCheckbox = {
116
+ type: "checkbox";
117
+ customId: string;
118
+ default?: boolean;
119
+ };
120
+ export type ModalCheckboxGroup = {
121
+ type: "checkbox_group";
122
+ customId: string;
123
+ minValues?: number;
124
+ maxValues?: number;
125
+ options: {
126
+ label: string;
127
+ value: string;
128
+ description?: string;
129
+ default?: boolean;
130
+ }[];
131
+ required?: boolean;
132
+ };
133
+ export type ModalTextDisplay = {
134
+ customId: string;
93
135
  content: string;
94
136
  };
95
137
  export type ModalLabelOptions = {
138
+ customId: string;
96
139
  label: string;
97
140
  description?: string;
98
141
  component: ModalLabelComponent;
99
142
  };
100
- export type ModalComponentBuilder = ActionRowBuilder<ModalActionRowComponentBuilder> | LabelBuilder | TextDisplayBuilder;
101
- type ModalComponentBase = ModalTextInput | ModalFileUploadOptions | ModalStringSelect | ModalUserSelect | ModalChannelSelect | ModalRoleSelect | ModalMentionableSelect;
143
+ export type ModalComponentBuilder = LabelBuilder | TextDisplayBuilder;
144
+ type ModalComponentBase = ModalTextInput | ModalFileUpload | ModalStringSelect | ModalUserSelect | ModalChannelSelect | ModalRoleSelect | ModalMentionableSelect | ModalRadioGroup | ModalCheckbox | ModalCheckboxGroup;
102
145
  export type ModalLabelComponent = DistributiveOmit<ModalComponentBase & {
103
146
  required?: boolean;
104
147
  disabled?: never;
@@ -107,6 +150,25 @@ export type FieldIndex = {
107
150
  index: number;
108
151
  customId: string;
109
152
  };
153
+ export type TextInputFieldIndex = FieldIndex & {
154
+ type: "text_input";
155
+ };
156
+ export type SelectMenuFieldIndex = FieldIndex & {
157
+ type: "select_menu";
158
+ };
159
+ export type FileUploadFieldIndex = FieldIndex & {
160
+ type: "file_upload";
161
+ };
162
+ export type RadioGroupFieldIndex = FieldIndex & {
163
+ type: "radio_group";
164
+ };
165
+ export type CheckboxFieldIndex = FieldIndex & {
166
+ type: "checkbox";
167
+ };
168
+ export type CheckboxGroupFieldIndex = FieldIndex & {
169
+ type: "checkbox_group";
170
+ };
171
+ export type ModalFieldIndex = TextInputFieldIndex | SelectMenuFieldIndex | FileUploadFieldIndex | RadioGroupFieldIndex | CheckboxFieldIndex | CheckboxGroupFieldIndex;
110
172
  export declare function MessageComponentModule(options: MessageComponentModuleOptions): <T extends Function>(constructor: T) => void;
111
173
  export declare function Button(options: InteractionButtonOptions | LinkButtonOptions): <T extends Function>(constructor: T) => void;
112
174
  export declare function StringSelectMenu(options: StringSelectMenuOptions): <T extends Function>(constructor: T) => void;
@@ -116,7 +178,12 @@ export declare function RoleSelectMenu(options: RoleSelectMenuOptions): <T exten
116
178
  export declare function MentionableSelectMenu(options: MentionableSelectMenuOptions): <T extends Function>(constructor: T) => void;
117
179
  export declare function Modal(options: ModalOptions): <T extends Function>(constructor: T) => void;
118
180
  export declare function ModalLabel(options: ModalLabelOptions): <T extends Function>(constructor: T) => void;
119
- export declare function ModalTextDisplay(options: ModalTextDisplayOptions): <T extends Function>(constructor: T) => void;
181
+ export declare function ModalTextDisplay(options: ModalTextDisplay): <T extends Function>(constructor: T) => void;
120
182
  export declare function TextInputFieldInjection(customId: string): (target: Object, _propertyKey: string | symbol | undefined, parameterIndex: number) => void;
183
+ export declare function SelectMenuFieldInjection(customId: string): (target: Object, _propertyKey: string | symbol | undefined, parameterIndex: number) => void;
184
+ export declare function FileUploadFieldInjection(customId: string): (target: Object, _propertyKey: string | symbol | undefined, parameterIndex: number) => void;
185
+ export declare function RadioGroupFieldInjection(customId: string): (target: Object, _propertyKey: string | symbol | undefined, parameterIndex: number) => void;
186
+ export declare function CheckboxFieldInjection(customId: string): (target: Object, _propertyKey: string | symbol | undefined, parameterIndex: number) => void;
187
+ export declare function CheckboxGroupFieldInjection(customId: string): (target: Object, _propertyKey: string | symbol | undefined, parameterIndex: number) => void;
121
188
  export {};
122
189
  //# sourceMappingURL=MessageComponentDecorator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MessageComponentDecorator.d.ts","sourceRoot":"","sources":["../../../src/structures/decorators/MessageComponentDecorator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAA4B,wBAAwB,EAAqB,YAAY,EAAgC,8BAA8B,EAAkD,kBAAkB,EAA2C,MAAM,YAAY,CAAC;AAC9S,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,cAAc,EAA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c,MAAM,GAAG,MAAM,GAAG,SAAS,EAAE,gBAAgB,MAAM,UAOrG;AAED,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,MAAM,IACpC,QAAQ,MAAM,EAAE,cAAc,MAAM,GAAG,MAAM,GAAG,SAAS,EAAE,gBAAgB,MAAM,UAOrG;AAED,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,IAClC,QAAQ,MAAM,EAAE,cAAc,MAAM,GAAG,MAAM,GAAG,SAAS,EAAE,gBAAgB,MAAM,UAOrG;AAED,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,MAAM,IACvC,QAAQ,MAAM,EAAE,cAAc,MAAM,GAAG,MAAM,GAAG,SAAS,EAAE,gBAAgB,MAAM,UAOrG"}
@@ -11,6 +11,11 @@ exports.Modal = Modal;
11
11
  exports.ModalLabel = ModalLabel;
12
12
  exports.ModalTextDisplay = ModalTextDisplay;
13
13
  exports.TextInputFieldInjection = TextInputFieldInjection;
14
+ exports.SelectMenuFieldInjection = SelectMenuFieldInjection;
15
+ exports.FileUploadFieldInjection = FileUploadFieldInjection;
16
+ exports.RadioGroupFieldInjection = RadioGroupFieldInjection;
17
+ exports.CheckboxFieldInjection = CheckboxFieldInjection;
18
+ exports.CheckboxGroupFieldInjection = CheckboxGroupFieldInjection;
14
19
  const discord_js_1 = require("discord.js");
15
20
  const _1 = require(".");
16
21
  const Constants_1 = require("../Constants");
@@ -178,8 +183,36 @@ function ModalLabel(options) {
178
183
  if ("required" in component)
179
184
  fileUpload.setRequired(component.required);
180
185
  label.setFileUploadComponent(fileUpload);
186
+ break;
187
+ case "radio_group":
188
+ const radioGroup = new discord_js_1.RadioGroupBuilder()
189
+ .setCustomId(component.customId)
190
+ .addOptions(component.options);
191
+ if ("required" in component)
192
+ radioGroup.setRequired(component.required);
193
+ label.setRadioGroupComponent(radioGroup);
194
+ break;
195
+ case "checkbox":
196
+ const checkbox = new discord_js_1.CheckboxBuilder()
197
+ .setCustomId(component.customId);
198
+ if ("default" in component)
199
+ checkbox.setDefault(component.default);
200
+ label.setCheckboxComponent(checkbox);
201
+ break;
202
+ case "checkbox_group":
203
+ const checkboxGroup = new discord_js_1.CheckboxGroupBuilder()
204
+ .setCustomId(component.customId)
205
+ .addOptions(component.options);
206
+ if (typeof component.minValues == "number")
207
+ checkboxGroup.setMinValues(component.minValues);
208
+ if (typeof component.maxValues == "number")
209
+ checkboxGroup.setMaxValues(component.maxValues);
210
+ if ("required" in component)
211
+ checkboxGroup.setRequired(component.required);
212
+ label.setCheckboxGroupComponent(checkboxGroup);
213
+ break;
181
214
  }
182
- components.push(label);
215
+ components.push({ customId: component.customId, component: label, outerType: "label", innerType: component.type });
183
216
  Reflect.defineMetadata(_1.MODAL_COMPONENTS_KEY, components, constructor);
184
217
  };
185
218
  }
@@ -188,14 +221,49 @@ function ModalTextDisplay(options) {
188
221
  const components = Reflect.getMetadata(_1.MODAL_COMPONENTS_KEY, constructor) ?? [];
189
222
  const textDisplay = new discord_js_1.TextDisplayBuilder()
190
223
  .setContent(options.content);
191
- components.push(textDisplay);
224
+ components.push({ customId: options.customId, component: textDisplay, outerType: "text_display" });
192
225
  Reflect.defineMetadata(_1.MODAL_COMPONENTS_KEY, components, constructor);
193
226
  };
194
227
  }
195
228
  function TextInputFieldInjection(customId) {
196
229
  return function (target, _propertyKey, parameterIndex) {
197
230
  const fields = Reflect.getMetadata(_1.MODAL_TEXT_INPUT_VALUE_INDEX_KEY, target) ?? [];
198
- fields.push({ index: parameterIndex, customId });
231
+ fields.push({ index: parameterIndex, customId, type: "text_input" });
199
232
  Reflect.defineMetadata(_1.MODAL_TEXT_INPUT_VALUE_INDEX_KEY, fields, target);
200
233
  };
201
234
  }
235
+ function SelectMenuFieldInjection(customId) {
236
+ return function (target, _propertyKey, parameterIndex) {
237
+ const fields = Reflect.getMetadata(_1.MODAL_SELECT_MENU_VALUE_INDEX_KEY, target) ?? [];
238
+ fields.push({ index: parameterIndex, customId, type: "select_menu" });
239
+ Reflect.defineMetadata(_1.MODAL_SELECT_MENU_VALUE_INDEX_KEY, fields, target);
240
+ };
241
+ }
242
+ function FileUploadFieldInjection(customId) {
243
+ return function (target, _propertyKey, parameterIndex) {
244
+ const fields = Reflect.getMetadata(_1.MODAL_FILE_UPLOAD_VALUE_INDEX_KEY, target) ?? [];
245
+ fields.push({ index: parameterIndex, customId, type: "file_upload" });
246
+ Reflect.defineMetadata(_1.MODAL_FILE_UPLOAD_VALUE_INDEX_KEY, fields, target);
247
+ };
248
+ }
249
+ function RadioGroupFieldInjection(customId) {
250
+ return function (target, _propertyKey, parameterIndex) {
251
+ const fields = Reflect.getMetadata(_1.MODAL_SELECT_MENU_VALUE_INDEX_KEY, target) ?? [];
252
+ fields.push({ index: parameterIndex, customId, type: "radio_group" });
253
+ Reflect.defineMetadata(_1.MODAL_SELECT_MENU_VALUE_INDEX_KEY, fields, target);
254
+ };
255
+ }
256
+ function CheckboxFieldInjection(customId) {
257
+ return function (target, _propertyKey, parameterIndex) {
258
+ const fields = Reflect.getMetadata(_1.MODAL_SELECT_MENU_VALUE_INDEX_KEY, target) ?? [];
259
+ fields.push({ index: parameterIndex, customId, type: "checkbox" });
260
+ Reflect.defineMetadata(_1.MODAL_SELECT_MENU_VALUE_INDEX_KEY, fields, target);
261
+ };
262
+ }
263
+ function CheckboxGroupFieldInjection(customId) {
264
+ return function (target, _propertyKey, parameterIndex) {
265
+ const fields = Reflect.getMetadata(_1.MODAL_SELECT_MENU_VALUE_INDEX_KEY, target) ?? [];
266
+ fields.push({ index: parameterIndex, customId, type: "checkbox_group" });
267
+ Reflect.defineMetadata(_1.MODAL_SELECT_MENU_VALUE_INDEX_KEY, fields, target);
268
+ };
269
+ }
@@ -1,5 +1,8 @@
1
1
  import { InteractionButtonOptions, LinkButtonOptions } from "../structures/decorators/MessageComponentDecorator";
2
2
  export declare class Util {
3
3
  static isInteractionButtonOptions(options: InteractionButtonOptions | LinkButtonOptions): options is InteractionButtonOptions;
4
+ static mergeDefault<T extends {
5
+ [key: PropertyKey]: any;
6
+ }>(def: T, given: Partial<T>): T;
4
7
  }
5
8
  //# sourceMappingURL=Util.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Util.d.ts","sourceRoot":"","sources":["../../src/utils/Util.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,MAAM,oDAAoD,CAAC;AAEjH,qBAAa,IAAI;IACb,MAAM,CAAC,0BAA0B,CAAC,OAAO,EAAE,wBAAwB,GAAG,iBAAiB,GAAG,OAAO,IAAI,wBAAwB;CAGhI"}
1
+ {"version":3,"file":"Util.d.ts","sourceRoot":"","sources":["../../src/utils/Util.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,MAAM,oDAAoD,CAAC;AAEjH,qBAAa,IAAI;IACb,MAAM,CAAC,0BAA0B,CAAC,OAAO,EAAE,wBAAwB,GAAG,iBAAiB,GAAG,OAAO,IAAI,wBAAwB;IAI7H,MAAM,CAAC,YAAY,CAAC,CAAC,SAAS;QAAE,CAAC,GAAG,EAAE,WAAW,GAAG,GAAG,CAAA;KAAE,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC;CAa3F"}
@@ -1,10 +1,23 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Util = void 0;
4
- const discord_js_1 = require("discord.js");
4
+ const v10_1 = require("discord-api-types/v10");
5
5
  class Util {
6
6
  static isInteractionButtonOptions(options) {
7
- return options.style != discord_js_1.ButtonStyle.Link;
7
+ return options.style != v10_1.ButtonStyle.Link;
8
+ }
9
+ static mergeDefault(def, given) {
10
+ if (!given)
11
+ return def;
12
+ for (const key in def) {
13
+ if (!Object.hasOwn(given, key) || given[key] === undefined) {
14
+ given[key] = def[key];
15
+ }
16
+ else if (given[key] === Object(given[key])) {
17
+ given[key] = this.mergeDefault(def[key], given[key]);
18
+ }
19
+ }
20
+ return given;
8
21
  }
9
22
  }
10
23
  exports.Util = Util;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oopscord.js",
3
- "version": "0.0.25",
3
+ "version": "0.0.27",
4
4
  "description": "An easy way to make discord apps in typescript.",
5
5
  "main": "dist",
6
6
  "scripts": {
@@ -29,9 +29,10 @@
29
29
  "reflect-metadata": "^0.1.14"
30
30
  },
31
31
  "devDependencies": {
32
- "@types/node": "^20.10.4",
33
- "discord.js": "^14.25.1",
32
+ "@types/node": "^20.19.35",
33
+ "discord.js": "14.26.4",
34
34
  "typescript": "^5.8.3",
35
+ "vitest": "^4.0.18",
35
36
  "yarn": "^1.22.21"
36
37
  }
37
38
  }
@@ -1,6 +0,0 @@
1
- import { Client as DJSClient } from "discord.js";
2
- export declare class Client extends DJSClient {
3
- registerCommands(): Promise<void>;
4
- login(token: string): Promise<string>;
5
- }
6
- //# sourceMappingURL=Client.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Client.d.ts","sourceRoot":"","sources":["../../src/structures/Client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,SAAS,EAAE,MAAM,YAAY,CAAC;AAEjD,qBAAa,MAAO,SAAQ,SAAS;IAC3B,gBAAgB;IA8BhB,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAK9C"}
@@ -1,43 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Client = void 0;
4
- const discord_js_1 = require("discord.js");
5
- class Client extends discord_js_1.Client {
6
- async registerCommands() {
7
- let oldCache = await Util.getCache();
8
- let newCache = Util.clientToCachedJSON(this);
9
- if (!Util.arraysEqual(oldCache.commands, newCache.commands) || !Util.arraysEqual(oldCache.contextmenus, newCache.contextmenus)) {
10
- let commands = [];
11
- this.commands.forEach(c => commands.push(c.toJSON()));
12
- this.contextMenuCommands.forEach(c => commands.push(c.toJSON()));
13
- if (this.kommando.test.enable) {
14
- if (this.kommando.test.guild == null)
15
- throw new TypeError("[options.test.guild] Expected string. but got null instead.");
16
- await this.restManager.put(Routes.applicationGuildCommands(this.user.id, this.kommando.test.guild), { body: commands });
17
- }
18
- else {
19
- await this.restManager.put(Routes.applicationCommands(this.user.id), { body: commands });
20
- }
21
- await Util.cacheClient(this);
22
- }
23
- return;
24
- }
25
- async login(token) {
26
- this.restManager.setToken(token);
27
- return await super.login(token);
28
- }
29
- }
30
- exports.Client = Client;
31
- function mergeDefault(def, given) {
32
- if (!given)
33
- return def;
34
- for (const key in def) {
35
- if (!Object.hasOwn(given, key) || given[key] === undefined) {
36
- given[key] = def[key];
37
- }
38
- else if (given[key] === Object(given[key])) {
39
- given[key] = mergeDefault(def[key], given[key]);
40
- }
41
- }
42
- return given;
43
- }
@@ -1,20 +0,0 @@
1
- import "reflect-metadata";
2
- import { ClientEvents, ClientOptions } from "discord.js";
3
- export interface ModuleOptions extends ClientOptions {
4
- token: string;
5
- imports: (new (...args: any[]) => any)[];
6
- test?: {
7
- enable: boolean;
8
- guild: null | string;
9
- };
10
- noAutoHandle?: boolean;
11
- disableCache?: boolean;
12
- }
13
- export declare const defaultModuleOptions: ModuleOptions;
14
- export interface DiscordModuleEvents {
15
- eventName: keyof ClientEvents;
16
- methodName: string;
17
- }
18
- export declare function DiscordModule(option1: ModuleOptions): <TFunction extends Function>(constructor: TFunction) => void;
19
- export declare function EventHandler(eventName: keyof ClientEvents): MethodDecorator;
20
- //# sourceMappingURL=DiscordModule.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DiscordModule.d.ts","sourceRoot":"","sources":["../../../src/structures/decorators/DiscordModule.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAGzD,MAAM,WAAW,aAAc,SAAQ,aAAa;IAChD,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,CAAC,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC,EAAE,CAAC;IACzC,IAAI,CAAC,EAAE;QACH,MAAM,EAAE,OAAO,CAAC;QAChB,KAAK,EAAE,IAAI,GAAG,MAAM,CAAA;KACvB,CAAC;IACF,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,YAAY,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,eAAO,MAAM,oBAAoB,EAAE,aAUlC,CAAA;AAED,MAAM,WAAW,mBAAmB;IAChC,SAAS,EAAE,MAAM,YAAY,CAAC;IAC9B,UAAU,EAAE,MAAM,CAAC;CACtB;AAQD,wBAAgB,aAAa,CAAC,OAAO,EAAE,aAAa,gEAMnD;AAED,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,YAAY,GAAG,eAAe,CAQ3E"}
@@ -1,56 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EventHandler = exports.DiscordModule = exports.defaultModuleOptions = void 0;
4
- require("reflect-metadata");
5
- const Constants_1 = require("./Constants");
6
- exports.defaultModuleOptions = {
7
- token: "",
8
- imports: [],
9
- test: {
10
- enable: false,
11
- guild: null,
12
- },
13
- noAutoHandle: false,
14
- disableCache: false,
15
- intents: []
16
- };
17
- // export interface ExternalModuleEvents {
18
- // eventName: string;
19
- // methodName: string;
20
- // eventEmitter: EventEmitter;
21
- // }
22
- function DiscordModule(option1) {
23
- return function (constructor) {
24
- const options = mergeDefault(exports.defaultModuleOptions, option1);
25
- Reflect.defineMetadata(Constants_1.DICSORD_MODULE_OPTIONS_KEY, options, constructor);
26
- };
27
- }
28
- exports.DiscordModule = DiscordModule;
29
- function EventHandler(eventName) {
30
- return function (target, propertyKey, propertyDescriptor) {
31
- const events = Reflect.getMetadata(Constants_1.DISCORD_MODULE_INTERNAL_EVENTS_KEY, target) ?? [];
32
- events.push({ eventName, methodName: propertyKey });
33
- Reflect.defineMetadata(Constants_1.DISCORD_MODULE_INTERNAL_EVENTS_KEY, events, target.constructor);
34
- };
35
- }
36
- exports.EventHandler = EventHandler;
37
- // export function ExternalEventHandler(eventName: string, eventEmitter: EventEmitter): MethodDecorator {
38
- // return function<T>(target: Object, propertyKey: string | symbol, propertyDescriptor: TypedPropertyDescriptor<T>) {
39
- // const events: ExternalModuleEvents[] = Reflect.getMetadata(DISCORD_MODULE_EXTERNAL_EVENTS_KEY, target) ?? [];
40
- // events.push({ eventName, methodName: propertyKey as string, eventEmitter });
41
- // Reflect.defineMetadata(DISCORD_MODULE_EXTERNAL_EVENTS_KEY, events, target.constructor);
42
- // }
43
- // }
44
- function mergeDefault(def, given) {
45
- if (!given)
46
- return def;
47
- for (const key in def) {
48
- if (!Object.hasOwn(given, key) || given[key] === undefined) {
49
- given[key] = def[key];
50
- }
51
- else if (given[key] === Object(given[key])) {
52
- given[key] = mergeDefault(def[key], given[key]);
53
- }
54
- }
55
- return given;
56
- }
@@ -1,5 +0,0 @@
1
- import { InteractionButtonOptions, LinkButtonOptions } from "../structures/decorators/MessageComponentDecorator";
2
- export declare class InteractionUtil {
3
- static isInteractionButtonOptions(options: InteractionButtonOptions | LinkButtonOptions): options is InteractionButtonOptions;
4
- }
5
- //# sourceMappingURL=InteractionUtil.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"InteractionUtil.d.ts","sourceRoot":"","sources":["../../src/utils/InteractionUtil.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,MAAM,oDAAoD,CAAC;AAEjH,qBAAa,eAAe;IACxB,MAAM,CAAC,0BAA0B,CAAC,OAAO,EAAE,wBAAwB,GAAG,iBAAiB,GAAG,OAAO,IAAI,wBAAwB;CAGhI"}
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.InteractionUtil = void 0;
4
- const v10_1 = require("discord-api-types/v10");
5
- class InteractionUtil {
6
- static isInteractionButtonOptions(options) {
7
- return options.style != v10_1.ButtonStyle.Link;
8
- }
9
- }
10
- exports.InteractionUtil = InteractionUtil;