@mostfeatured/dbi 0.0.25 → 0.0.26

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.
@@ -8,7 +8,7 @@ export interface IDBIButtonExecuteCtx extends IDBIBaseExecuteCtx {
8
8
  export declare type TDBIButtonOmitted = Omit<DBIButton, "type" | "description" | "dbi" | "toJSON">;
9
9
  export declare class DBIButton extends DBIBaseInteraction {
10
10
  constructor(dbi: DBI, args: TDBIButtonOmitted);
11
- options: Omit<Discord.ButtonComponentData, "customId" | "type">;
11
+ options?: Omit<Discord.ButtonComponentData, "customId" | "type"> | ((data: (number | string | any)[]) => Omit<Discord.ButtonComponentData, "customId" | "type">);
12
12
  onExecute(ctx: IDBIButtonExecuteCtx): Promise<any> | any;
13
13
  toJSON(...customData: (string | number | object)[]): Discord.ButtonComponentData;
14
14
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../src/types/Button.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,YAAY,CAAC;AACjC,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAC7B,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAG3F,MAAM,WAAW,oBAAqB,SAAQ,kBAAkB;IAC9D,WAAW,EAAE,OAAO,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IACjD,IAAI,EAAE,kBAAkB,EAAE,CAAC;CAC5B;AAED,oBAAY,iBAAiB,GAAG,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,aAAa,GAAG,KAAK,GAAG,QAAQ,CAAC,CAAC;AAE3F,qBAAa,SAAU,SAAQ,kBAAkB;gBACnC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,iBAAiB;IAOrC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,mBAAmB,EAAE,UAAU,GAAG,MAAM,CAAC,CAAC;IAE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}
@@ -16,7 +16,7 @@ class DBIButton extends Interaction_1.DBIBaseInteraction {
16
16
  ;
17
17
  toJSON(...customData) {
18
18
  return {
19
- ...this.options,
19
+ ...(typeof this.options == "function" ? this.options(customData) : this.options),
20
20
  customId: (0, customId_1.customIdBuilder)(this.dbi, this.name, customData),
21
21
  type: discord_js_1.default.ComponentType.Button
22
22
  };
@@ -1 +1 @@
1
- {"version":3,"file":"Button.js","sourceRoot":"","sources":["../../src/types/Button.ts"],"names":[],"mappings":";;;;AAAA,oEAAiC;AAEjC,+CAA2F;AAC3F,gDAAoD;AASpD,MAAa,SAAU,SAAQ,gCAAkB;IAC/C,YAAY,GAAQ,EAAE,IAAuB;QAC3C,KAAK,CAAC,GAAG,EAAE;YACT,GAAI,IAAY;YAChB,IAAI,EAAE,QAAQ;SACf,CAAC,CAAC;IACL,CAAC;IAIQ,SAAS,CAAC,GAAyB,IAAwB,CAAC;IAAA,CAAC;IAEtE,MAAM,CAAC,GAAG,UAAwC;QAChD,OAAO;YACL,GAAG,IAAI,CAAC,OAAO;YACf,QAAQ,EAAE,IAAA,0BAAe,EAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,EAAE,UAAU,CAAC;YAC1D,IAAI,EAAE,oBAAO,CAAC,aAAa,CAAC,MAAM;SAC5B,CAAC;IACX,CAAC;IAAA,CAAC;CACH;AAnBD,8BAmBC","sourcesContent":["import Discord from \"discord.js\";\r\nimport { DBI } from \"../DBI\";\r\nimport { DBIBaseInteraction, IDBIBaseExecuteCtx, TDBIReferencedData } from \"./Interaction\";\r\nimport { customIdBuilder } from \"../utils/customId\";\r\n\r\nexport interface IDBIButtonExecuteCtx extends IDBIBaseExecuteCtx {\r\n interaction: Discord.ButtonInteraction<\"cached\">;\r\n data: TDBIReferencedData[];\r\n}\r\n\r\nexport type TDBIButtonOmitted = Omit<DBIButton, \"type\" | \"description\" | \"dbi\" | \"toJSON\">;\r\n\r\nexport class DBIButton extends DBIBaseInteraction {\r\n constructor(dbi: DBI, args: TDBIButtonOmitted) {\r\n super(dbi, {\r\n ...(args as any),\r\n type: \"Button\",\r\n });\r\n }\r\n\r\n declare options: Omit<Discord.ButtonComponentData, \"customId\" | \"type\">;\r\n\r\n override onExecute(ctx: IDBIButtonExecuteCtx): Promise<any> | any { };\r\n\r\n toJSON(...customData: (string | number | object)[]): Discord.ButtonComponentData {\r\n return {\r\n ...this.options,\r\n customId: customIdBuilder(this.dbi, this.name, customData),\r\n type: Discord.ComponentType.Button\r\n } as any;\r\n };\r\n}"]}
1
+ {"version":3,"file":"Button.js","sourceRoot":"","sources":["../../src/types/Button.ts"],"names":[],"mappings":";;;;AAAA,oEAAiC;AAEjC,+CAA2F;AAC3F,gDAAoD;AASpD,MAAa,SAAU,SAAQ,gCAAkB;IAC/C,YAAY,GAAQ,EAAE,IAAuB;QAC3C,KAAK,CAAC,GAAG,EAAE;YACT,GAAI,IAAY;YAChB,IAAI,EAAE,QAAQ;SACf,CAAC,CAAC;IACL,CAAC;IAIQ,SAAS,CAAC,GAAyB,IAAwB,CAAC;IAAA,CAAC;IAEtE,MAAM,CAAC,GAAG,UAAwC;QAChD,OAAO;YACL,GAAG,CAAC,OAAO,IAAI,CAAC,OAAO,IAAI,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC;YAChF,QAAQ,EAAE,IAAA,0BAAe,EAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,EAAE,UAAU,CAAC;YAC1D,IAAI,EAAE,oBAAO,CAAC,aAAa,CAAC,MAAM;SAC5B,CAAC;IACX,CAAC;IAAA,CAAC;CACH;AAnBD,8BAmBC","sourcesContent":["import Discord from \"discord.js\";\r\nimport { DBI } from \"../DBI\";\r\nimport { DBIBaseInteraction, IDBIBaseExecuteCtx, TDBIReferencedData } from \"./Interaction\";\r\nimport { customIdBuilder } from \"../utils/customId\";\r\n\r\nexport interface IDBIButtonExecuteCtx extends IDBIBaseExecuteCtx {\r\n interaction: Discord.ButtonInteraction<\"cached\">;\r\n data: TDBIReferencedData[];\r\n}\r\n\r\nexport type TDBIButtonOmitted = Omit<DBIButton, \"type\" | \"description\" | \"dbi\" | \"toJSON\">;\r\n\r\nexport class DBIButton extends DBIBaseInteraction {\r\n constructor(dbi: DBI, args: TDBIButtonOmitted) {\r\n super(dbi, {\r\n ...(args as any),\r\n type: \"Button\",\r\n });\r\n }\r\n\r\n declare options?: Omit<Discord.ButtonComponentData, \"customId\" | \"type\"> | ((data: (number | string | any)[]) => Omit<Discord.ButtonComponentData, \"customId\" | \"type\">);\r\n\r\n override onExecute(ctx: IDBIButtonExecuteCtx): Promise<any> | any { };\r\n\r\n toJSON(...customData: (string | number | object)[]): Discord.ButtonComponentData {\r\n return {\r\n ...(typeof this.options == \"function\" ? this.options(customData) : this.options),\r\n customId: customIdBuilder(this.dbi, this.name, customData),\r\n type: Discord.ComponentType.Button\r\n } as any;\r\n };\r\n}"]}
@@ -8,7 +8,7 @@ export interface IDBIModalExecuteCtx extends IDBIBaseExecuteCtx {
8
8
  export declare type TDBIModalOmitted = Omit<DBIModal, "type" | "description" | "dbi" | "toJSON">;
9
9
  export declare class DBIModal extends DBIBaseInteraction {
10
10
  constructor(dbi: DBI, cfg: TDBIModalOmitted);
11
- options: Omit<Discord.ModalComponentData, "customId">;
11
+ options: Omit<Discord.ModalComponentData, "customId"> | ((data: (number | string | any)[]) => Omit<Discord.ModalComponentData, "customId">);
12
12
  onExecute(ctx: IDBIModalExecuteCtx): Promise<any> | any;
13
13
  toJSON(...customData: (string | number | object)[]): Discord.ModalComponentData;
14
14
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../../src/types/Modal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAC7B,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,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AG,EAAE,GAAG,EAAE,GAAG,EAAE,gBAAgB;IAOnC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,kBAAkB,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,MAAM,GAAG,GAAG,CAAC,EAAE,KAAK,IAAI,CAAC,OAAO,CAAC,kBAAkB,EAAE,UAAU,CAAC,CAAC,CAAC;IAE3I,SAAS,CAAC,GAAG,EAAE,mBAAmB,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,GAAG;IAEhE,MAAM,CAAC,GAAG,UAAU,EAAE,CAAC,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC,EAAE,GAAG,OAAO,CAAC,kBAAkB;CAMhF"}
@@ -14,7 +14,7 @@ class DBIModal extends Interaction_1.DBIBaseInteraction {
14
14
  ;
15
15
  toJSON(...customData) {
16
16
  return {
17
- ...this.options,
17
+ ...(typeof this.options == "function" ? this.options(customData) : this.options),
18
18
  customId: (0, customId_1.customIdBuilder)(this.dbi, this.name, customData)
19
19
  };
20
20
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Modal.js","sourceRoot":"","sources":["../../src/types/Modal.ts"],"names":[],"mappings":";;;AACA,+CAA2F;AAE3F,gDAAoD;AAUpD,MAAa,QAAS,SAAQ,gCAAkB;IAC9C,YAAY,GAAQ,EAAE,GAAqB;QACzC,KAAK,CAAC,GAAG,EAAE;YACT,GAAI,GAAW;YACf,IAAI,EAAE,OAAO;SACd,CAAC,CAAA;IACJ,CAAC;IAIQ,SAAS,CAAC,GAAwB,IAAwB,CAAC;IAAA,CAAC;IAErE,MAAM,CAAC,GAAG,UAAwC;QAChD,OAAO;YACL,GAAG,IAAI,CAAC,OAAO;YACf,QAAQ,EAAE,IAAA,0BAAe,EAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,EAAE,UAAU,CAAC;SACpD,CAAC;IACX,CAAC;IAAA,CAAC;CACH;AAlBD,4BAkBC","sourcesContent":["import { DBI } from \"../DBI\";\r\nimport { DBIBaseInteraction, IDBIBaseExecuteCtx, TDBIReferencedData } from \"./Interaction\";\r\nimport Discord from \"discord.js\";\r\nimport { customIdBuilder } from \"../utils/customId\";\r\n\r\nexport interface IDBIModalExecuteCtx extends IDBIBaseExecuteCtx {\r\n interaction: Discord.ModalSubmitInteraction<\"cached\">;\r\n\r\n data: TDBIReferencedData[];\r\n}\r\n\r\nexport type TDBIModalOmitted = Omit<DBIModal, \"type\" | \"description\" | \"dbi\" | \"toJSON\">;\r\n\r\nexport class DBIModal extends DBIBaseInteraction {\r\n constructor(dbi: DBI, cfg: TDBIModalOmitted) {\r\n super(dbi, {\r\n ...(cfg as any),\r\n type: \"Modal\"\r\n })\r\n }\r\n\r\n declare options: Omit<Discord.ModalComponentData, \"customId\">;\r\n\r\n override onExecute(ctx: IDBIModalExecuteCtx): Promise<any> | any { };\r\n\r\n toJSON(...customData: (string | number | object)[]): Discord.ModalComponentData {\r\n return {\r\n ...this.options,\r\n customId: customIdBuilder(this.dbi, this.name, customData)\r\n } as any;\r\n };\r\n}"]}
1
+ {"version":3,"file":"Modal.js","sourceRoot":"","sources":["../../src/types/Modal.ts"],"names":[],"mappings":";;;AACA,+CAA2F;AAE3F,gDAAoD;AAUpD,MAAa,QAAS,SAAQ,gCAAkB;IAC9C,YAAY,GAAQ,EAAE,GAAqB;QACzC,KAAK,CAAC,GAAG,EAAE;YACT,GAAI,GAAW;YACf,IAAI,EAAE,OAAO;SACd,CAAC,CAAA;IACJ,CAAC;IAIQ,SAAS,CAAC,GAAwB,IAAwB,CAAC;IAAA,CAAC;IAErE,MAAM,CAAC,GAAG,UAAwC;QAChD,OAAO;YACL,GAAG,CAAC,OAAO,IAAI,CAAC,OAAO,IAAI,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC;YAChF,QAAQ,EAAE,IAAA,0BAAe,EAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,EAAE,UAAU,CAAC;SACpD,CAAC;IACX,CAAC;IAAA,CAAC;CACH;AAlBD,4BAkBC","sourcesContent":["import { DBI } from \"../DBI\";\r\nimport { DBIBaseInteraction, IDBIBaseExecuteCtx, TDBIReferencedData } from \"./Interaction\";\r\nimport Discord from \"discord.js\";\r\nimport { customIdBuilder } from \"../utils/customId\";\r\n\r\nexport interface IDBIModalExecuteCtx extends IDBIBaseExecuteCtx {\r\n interaction: Discord.ModalSubmitInteraction<\"cached\">;\r\n\r\n data: TDBIReferencedData[];\r\n}\r\n\r\nexport type TDBIModalOmitted = Omit<DBIModal, \"type\" | \"description\" | \"dbi\" | \"toJSON\">;\r\n\r\nexport class DBIModal extends DBIBaseInteraction {\r\n constructor(dbi: DBI, cfg: TDBIModalOmitted) {\r\n super(dbi, {\r\n ...(cfg as any),\r\n type: \"Modal\"\r\n })\r\n }\r\n\r\n declare options: Omit<Discord.ModalComponentData, \"customId\"> | ((data: (number | string | any)[]) => Omit<Discord.ModalComponentData, \"customId\">);\r\n\r\n override onExecute(ctx: IDBIModalExecuteCtx): Promise<any> | any { };\r\n\r\n toJSON(...customData: (string | number | object)[]): Discord.ModalComponentData {\r\n return {\r\n ...(typeof this.options == \"function\" ? this.options(customData) : this.options),\r\n customId: customIdBuilder(this.dbi, this.name, customData)\r\n } as any;\r\n };\r\n}"]}
@@ -8,7 +8,7 @@ export interface IDBISelectMenuExecuteCtx extends IDBIBaseExecuteCtx {
8
8
  export declare type TDBISelectMenuOmitted = Omit<DBIBaseInteraction, "type" | "description" | "dbi" | "toJSON">;
9
9
  export declare class DBISelectMenu extends DBIBaseInteraction {
10
10
  constructor(dbi: DBI, args: TDBISelectMenuOmitted);
11
- options: Omit<Discord.SelectMenuComponentData, "customId" | "type">;
11
+ options: Omit<Discord.SelectMenuComponentData, "customId" | "type"> | ((data: (number | string | any)[]) => Omit<Discord.SelectMenuComponentData, "customId" | "type">);
12
12
  onExecute(ctx: IDBISelectMenuExecuteCtx): Promise<any> | any;
13
13
  toJSON(...customData: (string | number | object)[]): Discord.SelectMenuComponentData;
14
14
  }
@@ -1 +1 @@
1
- {"version":3,"file":"SelectMenu.d.ts","sourceRoot":"","sources":["../../src/types/SelectMenu.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,YAAY,CAAC;AACjC,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAC7B,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAG3F,MAAM,WAAW,wBAAyB,SAAQ,kBAAkB;IAClE,WAAW,EAAE,OAAO,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IACjD,IAAI,EAAE,kBAAkB,EAAE,CAAC;CAC5B;AAED,oBAAY,qBAAqB,GAAG,IAAI,CAAC,kBAAkB,EAAE,MAAM,GAAG,aAAa,GAAG,KAAK,GAAG,QAAQ,CAAC,CAAC;AAExG,qBAAa,aAAc,SAAQ,kBAAkB;gBACvC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,qBAAqB;IAOzC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,uBAAuB,EAAE,UAAU,GAAG,MAAM,CAAC,CAAC;IAEnE,SAAS,CAAC,GAAG,EAAE,wBAAwB,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,GAAG;IAErE,MAAM,CAAC,GAAG,UAAU,EAAE,CAAC,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC,EAAE,GAAG,OAAO,CAAC,uBAAuB;CAOrF"}
1
+ {"version":3,"file":"SelectMenu.d.ts","sourceRoot":"","sources":["../../src/types/SelectMenu.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,YAAY,CAAC;AACjC,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAC7B,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAG3F,MAAM,WAAW,wBAAyB,SAAQ,kBAAkB;IAClE,WAAW,EAAE,OAAO,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IACjD,IAAI,EAAE,kBAAkB,EAAE,CAAC;CAC5B;AAED,oBAAY,qBAAqB,GAAG,IAAI,CAAC,kBAAkB,EAAE,MAAM,GAAG,aAAa,GAAG,KAAK,GAAG,QAAQ,CAAC,CAAC;AAExG,qBAAa,aAAc,SAAQ,kBAAkB;gBACvC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,qBAAqB;IAOzC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,uBAAuB,EAAE,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,MAAM,GAAG,GAAG,CAAC,EAAE,KAAK,IAAI,CAAC,OAAO,CAAC,uBAAuB,EAAE,UAAU,GAAG,MAAM,CAAC,CAAC,CAAC;IAEvK,SAAS,CAAC,GAAG,EAAE,wBAAwB,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,GAAG;IAErE,MAAM,CAAC,GAAG,UAAU,EAAE,CAAC,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC,EAAE,GAAG,OAAO,CAAC,uBAAuB;CAOrF"}
@@ -16,7 +16,7 @@ class DBISelectMenu extends Interaction_1.DBIBaseInteraction {
16
16
  ;
17
17
  toJSON(...customData) {
18
18
  return {
19
- ...this.options,
19
+ ...(typeof this.options == "function" ? this.options(customData) : this.options),
20
20
  customId: (0, customId_1.customIdBuilder)(this.dbi, this.name, customData),
21
21
  type: discord_js_1.default.ComponentType.SelectMenu
22
22
  };
@@ -1 +1 @@
1
- {"version":3,"file":"SelectMenu.js","sourceRoot":"","sources":["../../src/types/SelectMenu.ts"],"names":[],"mappings":";;;;AAAA,oEAAiC;AAEjC,+CAA2F;AAC3F,gDAAoD;AASpD,MAAa,aAAc,SAAQ,gCAAkB;IACnD,YAAY,GAAQ,EAAE,IAA2B;QAC/C,KAAK,CAAC,GAAG,EAAE;YACT,GAAI,IAAY;YAChB,IAAI,EAAE,YAAY;SACnB,CAAC,CAAC;IACL,CAAC;IAIQ,SAAS,CAAC,GAA6B,IAAwB,CAAC;IAAA,CAAC;IAE1E,MAAM,CAAC,GAAG,UAAwC;QAChD,OAAO;YACL,GAAG,IAAI,CAAC,OAAO;YACf,QAAQ,EAAE,IAAA,0BAAe,EAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,EAAE,UAAU,CAAC;YAC1D,IAAI,EAAE,oBAAO,CAAC,aAAa,CAAC,UAAU;SAChC,CAAA;IACV,CAAC;IAAA,CAAC;CACH;AAnBD,sCAmBC","sourcesContent":["import Discord from \"discord.js\";\r\nimport { DBI } from \"../DBI\";\r\nimport { DBIBaseInteraction, IDBIBaseExecuteCtx, TDBIReferencedData } from \"./Interaction\";\r\nimport { customIdBuilder } from \"../utils/customId\";\r\n\r\nexport interface IDBISelectMenuExecuteCtx extends IDBIBaseExecuteCtx {\r\n interaction: Discord.ButtonInteraction<\"cached\">;\r\n data: TDBIReferencedData[];\r\n}\r\n\r\nexport type TDBISelectMenuOmitted = Omit<DBIBaseInteraction, \"type\" | \"description\" | \"dbi\" | \"toJSON\">;\r\n\r\nexport class DBISelectMenu extends DBIBaseInteraction {\r\n constructor(dbi: DBI, args: TDBISelectMenuOmitted) {\r\n super(dbi, {\r\n ...(args as any),\r\n type: \"SelectMenu\",\r\n });\r\n }\r\n\r\n declare options: Omit<Discord.SelectMenuComponentData, \"customId\" | \"type\">;\r\n\r\n override onExecute(ctx: IDBISelectMenuExecuteCtx): Promise<any> | any { };\r\n\r\n toJSON(...customData: (string | number | object)[]): Discord.SelectMenuComponentData {\r\n return {\r\n ...this.options,\r\n customId: customIdBuilder(this.dbi, this.name, customData),\r\n type: Discord.ComponentType.SelectMenu\r\n } as any\r\n };\r\n}"]}
1
+ {"version":3,"file":"SelectMenu.js","sourceRoot":"","sources":["../../src/types/SelectMenu.ts"],"names":[],"mappings":";;;;AAAA,oEAAiC;AAEjC,+CAA2F;AAC3F,gDAAoD;AASpD,MAAa,aAAc,SAAQ,gCAAkB;IACnD,YAAY,GAAQ,EAAE,IAA2B;QAC/C,KAAK,CAAC,GAAG,EAAE;YACT,GAAI,IAAY;YAChB,IAAI,EAAE,YAAY;SACnB,CAAC,CAAC;IACL,CAAC;IAIQ,SAAS,CAAC,GAA6B,IAAwB,CAAC;IAAA,CAAC;IAE1E,MAAM,CAAC,GAAG,UAAwC;QAChD,OAAO;YACL,GAAG,CAAC,OAAO,IAAI,CAAC,OAAO,IAAI,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC;YAChF,QAAQ,EAAE,IAAA,0BAAe,EAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,EAAE,UAAU,CAAC;YAC1D,IAAI,EAAE,oBAAO,CAAC,aAAa,CAAC,UAAU;SAChC,CAAA;IACV,CAAC;IAAA,CAAC;CACH;AAnBD,sCAmBC","sourcesContent":["import Discord from \"discord.js\";\r\nimport { DBI } from \"../DBI\";\r\nimport { DBIBaseInteraction, IDBIBaseExecuteCtx, TDBIReferencedData } from \"./Interaction\";\r\nimport { customIdBuilder } from \"../utils/customId\";\r\n\r\nexport interface IDBISelectMenuExecuteCtx extends IDBIBaseExecuteCtx {\r\n interaction: Discord.ButtonInteraction<\"cached\">;\r\n data: TDBIReferencedData[];\r\n}\r\n\r\nexport type TDBISelectMenuOmitted = Omit<DBIBaseInteraction, \"type\" | \"description\" | \"dbi\" | \"toJSON\">;\r\n\r\nexport class DBISelectMenu extends DBIBaseInteraction {\r\n constructor(dbi: DBI, args: TDBISelectMenuOmitted) {\r\n super(dbi, {\r\n ...(args as any),\r\n type: \"SelectMenu\",\r\n });\r\n }\r\n\r\n declare options: Omit<Discord.SelectMenuComponentData, \"customId\" | \"type\"> | ((data: (number | string | any)[]) => Omit<Discord.SelectMenuComponentData, \"customId\" | \"type\">);\r\n\r\n override onExecute(ctx: IDBISelectMenuExecuteCtx): Promise<any> | any { };\r\n\r\n toJSON(...customData: (string | number | object)[]): Discord.SelectMenuComponentData {\r\n return {\r\n ...(typeof this.options == \"function\" ? this.options(customData) : this.options),\r\n customId: customIdBuilder(this.dbi, this.name, customData),\r\n type: Discord.ComponentType.SelectMenu\r\n } as any\r\n };\r\n}"]}
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "stuffs": "^0.1.17"
10
10
  },
11
11
  "name": "@mostfeatured/dbi",
12
- "version": "0.0.25",
12
+ "version": "0.0.26",
13
13
  "main": "dist/index.js",
14
14
  "type": "commonjs",
15
15
  "private": false,
@@ -18,13 +18,13 @@ export class DBIButton extends DBIBaseInteraction {
18
18
  });
19
19
  }
20
20
 
21
- declare options: Omit<Discord.ButtonComponentData, "customId" | "type">;
21
+ declare options?: Omit<Discord.ButtonComponentData, "customId" | "type"> | ((data: (number | string | any)[]) => Omit<Discord.ButtonComponentData, "customId" | "type">);
22
22
 
23
23
  override onExecute(ctx: IDBIButtonExecuteCtx): Promise<any> | any { };
24
24
 
25
25
  toJSON(...customData: (string | number | object)[]): Discord.ButtonComponentData {
26
26
  return {
27
- ...this.options,
27
+ ...(typeof this.options == "function" ? this.options(customData) : this.options),
28
28
  customId: customIdBuilder(this.dbi, this.name, customData),
29
29
  type: Discord.ComponentType.Button
30
30
  } as any;
@@ -19,13 +19,13 @@ export class DBIModal extends DBIBaseInteraction {
19
19
  })
20
20
  }
21
21
 
22
- declare options: Omit<Discord.ModalComponentData, "customId">;
22
+ declare options: Omit<Discord.ModalComponentData, "customId"> | ((data: (number | string | any)[]) => Omit<Discord.ModalComponentData, "customId">);
23
23
 
24
24
  override onExecute(ctx: IDBIModalExecuteCtx): Promise<any> | any { };
25
25
 
26
26
  toJSON(...customData: (string | number | object)[]): Discord.ModalComponentData {
27
27
  return {
28
- ...this.options,
28
+ ...(typeof this.options == "function" ? this.options(customData) : this.options),
29
29
  customId: customIdBuilder(this.dbi, this.name, customData)
30
30
  } as any;
31
31
  };
@@ -18,13 +18,13 @@ export class DBISelectMenu extends DBIBaseInteraction {
18
18
  });
19
19
  }
20
20
 
21
- declare options: Omit<Discord.SelectMenuComponentData, "customId" | "type">;
21
+ declare options: Omit<Discord.SelectMenuComponentData, "customId" | "type"> | ((data: (number | string | any)[]) => Omit<Discord.SelectMenuComponentData, "customId" | "type">);
22
22
 
23
23
  override onExecute(ctx: IDBISelectMenuExecuteCtx): Promise<any> | any { };
24
24
 
25
25
  toJSON(...customData: (string | number | object)[]): Discord.SelectMenuComponentData {
26
26
  return {
27
- ...this.options,
27
+ ...(typeof this.options == "function" ? this.options(customData) : this.options),
28
28
  customId: customIdBuilder(this.dbi, this.name, customData),
29
29
  type: Discord.ComponentType.SelectMenu
30
30
  } as any