@open-discord-bots/framework 0.3.17 → 0.3.18
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 +1 -1
- package/dist/api/modules/builder.js +11 -19
- package/package.json +1 -1
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.
|
|
47
|
+
this.versions.add(ODVersion.fromString("opendiscord:api", "v0.3.18"));
|
|
48
48
|
this.versions.add(ODVersion.fromString("opendiscord:livestatus", "v2.0.0"));
|
|
49
49
|
this.debugfile = managers.debugfile;
|
|
50
50
|
this.console = managers.console;
|
|
@@ -889,26 +889,16 @@ export class ODEmbedInstance {
|
|
|
889
889
|
}
|
|
890
890
|
/**Set the fields of this embed */
|
|
891
891
|
setFields(fields) {
|
|
892
|
-
//
|
|
893
|
-
fields.
|
|
894
|
-
|
|
895
|
-
throw new ODSystemError("ODEmbed:setFields() => field " + index + " reached 1024 character limit!");
|
|
896
|
-
if (field.name.length >= 256)
|
|
897
|
-
throw new ODSystemError("ODEmbed:setFields() => field " + index + " reached 256 name character limit!");
|
|
898
|
-
});
|
|
899
|
-
this.data.fields = fields;
|
|
892
|
+
//remap fields
|
|
893
|
+
const correctedFields = fields.map((field) => ({ name: field.name.slice(0, 256), value: field.value.slice(0, 1024), inline: field.inline }));
|
|
894
|
+
this.data.fields = correctedFields;
|
|
900
895
|
return this;
|
|
901
896
|
}
|
|
902
897
|
/**Add fields to this embed */
|
|
903
898
|
addFields(...fields) {
|
|
904
|
-
//
|
|
905
|
-
fields.
|
|
906
|
-
|
|
907
|
-
throw new ODSystemError("ODEmbed:addFields() => field " + index + " reached 1024 character limit!");
|
|
908
|
-
if (field.name.length >= 256)
|
|
909
|
-
throw new ODSystemError("ODEmbed:addFields() => field " + index + " reached 256 name character limit!");
|
|
910
|
-
});
|
|
911
|
-
this.data.fields.push(...fields);
|
|
899
|
+
//remap fields
|
|
900
|
+
const correctedFields = fields.map((field) => ({ name: field.name.slice(0, 256), value: field.value.slice(0, 1024), inline: field.inline }));
|
|
901
|
+
this.data.fields.push(...correctedFields);
|
|
912
902
|
return this;
|
|
913
903
|
}
|
|
914
904
|
/**Clear all fields from this embed */
|
|
@@ -1436,7 +1426,6 @@ export class ODModal extends ODBuilderImplementation {
|
|
|
1436
1426
|
const input = new discord.TextInputBuilder()
|
|
1437
1427
|
.setStyle(question.style == "paragraph" ? discord.TextInputStyle.Paragraph : discord.TextInputStyle.Short)
|
|
1438
1428
|
.setCustomId(question.customId)
|
|
1439
|
-
.setLabel(question.label ? question.label : question.customId)
|
|
1440
1429
|
.setRequired(question.required ? true : false);
|
|
1441
1430
|
if (question.minLength)
|
|
1442
1431
|
input.setMinLength(question.minLength);
|
|
@@ -1446,8 +1435,11 @@ export class ODModal extends ODBuilderImplementation {
|
|
|
1446
1435
|
input.setValue(question.value);
|
|
1447
1436
|
if (question.placeholder)
|
|
1448
1437
|
input.setPlaceholder(question.placeholder);
|
|
1449
|
-
|
|
1450
|
-
.
|
|
1438
|
+
const label = new discord.LabelBuilder({
|
|
1439
|
+
label: (question.label ? question.label : question.customId),
|
|
1440
|
+
component: input.toJSON()
|
|
1441
|
+
});
|
|
1442
|
+
modal.addLabelComponents(label);
|
|
1451
1443
|
});
|
|
1452
1444
|
this.cache = { id: this.id, modal };
|
|
1453
1445
|
this.didCache = true;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-discord-bots/framework",
|
|
3
3
|
"author": "DJj123dj",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.18",
|
|
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",
|