@open-discord-bots/framework 0.3.16 → 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 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.16"));
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
- //TEMP CHECKS
893
- fields.forEach((field, index) => {
894
- if (field.value.length >= 1024)
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
- //TEMP CHECKS
905
- fields.forEach((field, index) => {
906
- if (field.value.length >= 1024)
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
- modal.addComponents(new discord.ActionRowBuilder()
1450
- .addComponents(input));
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;
@@ -182,8 +182,8 @@ export class ODState extends ODManagerData {
182
182
  }
183
183
  /**Delete all message states from this ODState. */
184
184
  async clearAllMsgStates() {
185
- for (const state of await this.database.getAll()) {
186
- await this.database.delete(state.category, state.key);
185
+ for (const state of await this.listMsgStates()) {
186
+ await this.database.delete(this.id.value, state.key);
187
187
  }
188
188
  }
189
189
  /**Delete a message state using the raw key. Returns `true` when deleted. */
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.16",
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",