@open-discord-bots/framework 0.4.5 → 0.4.7
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.4.
|
|
47
|
+
this.versions.add(ODVersion.fromString("opendiscord:api", "v0.4.7"));
|
|
48
48
|
this.versions.add(ODVersion.fromString("opendiscord:livestatus", "v2.0.0"));
|
|
49
49
|
this.debugfile = managers.debugfile;
|
|
50
50
|
this.console = managers.console;
|
|
@@ -15,7 +15,7 @@ export declare class ODComponentFactoryInstance<Component extends ODComponent<ob
|
|
|
15
15
|
/**The root component of this factory. */
|
|
16
16
|
getComponent(): Component | null;
|
|
17
17
|
/**Set the root component of this factory. */
|
|
18
|
-
setComponent
|
|
18
|
+
setComponent<SetComponent extends Component | null>(c: SetComponent): SetComponent;
|
|
19
19
|
}
|
|
20
20
|
/**## ODComponentFactory `class`
|
|
21
21
|
* An Open Discord component factory.
|
|
@@ -858,6 +858,8 @@ export interface ODDropdownComponentData {
|
|
|
858
858
|
maxValues?: number;
|
|
859
859
|
/**Is this dropdown disabled? */
|
|
860
860
|
disabled?: boolean;
|
|
861
|
+
/**Is this dropdown required? (MODAL ONLY) */
|
|
862
|
+
required?: boolean;
|
|
861
863
|
/**Allowed channel types when the type is "channel" */
|
|
862
864
|
channelTypes?: discord.ChannelType[];
|
|
863
865
|
/**The options when the type is "string" */
|
|
@@ -890,6 +892,8 @@ export declare class ODDropdownComponent extends ODComponent<ODDropdownComponent
|
|
|
890
892
|
setPlaceholder(placeholder: string | null): this;
|
|
891
893
|
/**Disable this dropdown. */
|
|
892
894
|
setDisabled(disabled: boolean): this;
|
|
895
|
+
/**Mark this dropdown as required in modals. */
|
|
896
|
+
setRequired(required: boolean): this;
|
|
893
897
|
/**Set the available channel types of this dropdown. */
|
|
894
898
|
setChannelTypes(channelTypes: discord.ChannelType[]): this;
|
|
895
899
|
/**Set the options of this dropdown (when `type == "string"`) */
|
|
@@ -20,7 +20,7 @@ export class ODComponentFactoryInstance {
|
|
|
20
20
|
/**Set the root component of this factory. */
|
|
21
21
|
setComponent(c) {
|
|
22
22
|
this.rootComponent = c;
|
|
23
|
-
return
|
|
23
|
+
return c;
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
/**## ODComponentFactory `class`
|
|
@@ -1253,7 +1253,7 @@ export class ODDropdownComponent extends ODComponent {
|
|
|
1253
1253
|
return new discord.StringSelectMenuBuilder({
|
|
1254
1254
|
...genericOpts,
|
|
1255
1255
|
options: this.data.options
|
|
1256
|
-
});
|
|
1256
|
+
}).setRequired(this.data.required ?? false);
|
|
1257
1257
|
}
|
|
1258
1258
|
else if (this.data.type == "user") {
|
|
1259
1259
|
if (!this.data.users || this.data.users.length < 1)
|
|
@@ -1261,7 +1261,7 @@ export class ODDropdownComponent extends ODComponent {
|
|
|
1261
1261
|
return new discord.UserSelectMenuBuilder({
|
|
1262
1262
|
...genericOpts,
|
|
1263
1263
|
defaultValues: this.data.users.map((u) => ({ id: u.id, type: discord.SelectMenuDefaultValueType.User }))
|
|
1264
|
-
});
|
|
1264
|
+
}).setRequired(this.data.required ?? false);
|
|
1265
1265
|
}
|
|
1266
1266
|
else if (this.data.type == "role") {
|
|
1267
1267
|
if (!this.data.roles || this.data.roles.length < 1)
|
|
@@ -1269,7 +1269,7 @@ export class ODDropdownComponent extends ODComponent {
|
|
|
1269
1269
|
return new discord.RoleSelectMenuBuilder({
|
|
1270
1270
|
...genericOpts,
|
|
1271
1271
|
defaultValues: this.data.roles.map((r) => ({ id: r.id, type: discord.SelectMenuDefaultValueType.Role }))
|
|
1272
|
-
});
|
|
1272
|
+
}).setRequired(this.data.required ?? false);
|
|
1273
1273
|
}
|
|
1274
1274
|
else if (this.data.type == "channel") {
|
|
1275
1275
|
if (!this.data.channels || this.data.channels.length < 1)
|
|
@@ -1278,7 +1278,7 @@ export class ODDropdownComponent extends ODComponent {
|
|
|
1278
1278
|
...genericOpts,
|
|
1279
1279
|
channelTypes: this.data.channelTypes,
|
|
1280
1280
|
defaultValues: this.data.channels.map((c) => ({ id: c.id, type: discord.SelectMenuDefaultValueType.Channel }))
|
|
1281
|
-
});
|
|
1281
|
+
}).setRequired(this.data.required ?? false);
|
|
1282
1282
|
}
|
|
1283
1283
|
else if (this.data.type == "mentionable") {
|
|
1284
1284
|
if (!this.data.mentionables || this.data.mentionables.length < 1)
|
|
@@ -1286,7 +1286,7 @@ export class ODDropdownComponent extends ODComponent {
|
|
|
1286
1286
|
return new discord.MentionableSelectMenuBuilder({
|
|
1287
1287
|
...genericOpts,
|
|
1288
1288
|
defaultValues: this.data.mentionables.map((m) => (m instanceof discord.User ? { id: m.id, type: discord.SelectMenuDefaultValueType.User } : { id: m.id, type: discord.SelectMenuDefaultValueType.Role }))
|
|
1289
|
-
});
|
|
1289
|
+
}).setRequired(this.data.required ?? false);
|
|
1290
1290
|
}
|
|
1291
1291
|
else
|
|
1292
1292
|
throw new ODSystemError("ODDropdownComponent:build('" + this.id.value + "') => Please set the dropdown type to one of the following: string, user, role, channel, mentionable.");
|
|
@@ -1321,6 +1321,11 @@ export class ODDropdownComponent extends ODComponent {
|
|
|
1321
1321
|
this.data.disabled = disabled;
|
|
1322
1322
|
return this;
|
|
1323
1323
|
}
|
|
1324
|
+
/**Mark this dropdown as required in modals. */
|
|
1325
|
+
setRequired(required) {
|
|
1326
|
+
this.data.required = required;
|
|
1327
|
+
return this;
|
|
1328
|
+
}
|
|
1324
1329
|
/**Set the available channel types of this dropdown. */
|
|
1325
1330
|
setChannelTypes(channelTypes) {
|
|
1326
1331
|
this.data.channelTypes = channelTypes;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-discord-bots/framework",
|
|
3
3
|
"author": "DJj123dj",
|
|
4
|
-
"version": "0.4.
|
|
4
|
+
"version": "0.4.7",
|
|
5
5
|
"description": "The core framework of the popular open-source discord bots: Open Ticket & Open Moderation.",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|