@mostfeatured/dbi 0.1.11 → 0.1.13-dev.1

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.
@@ -7,7 +7,7 @@ export interface IDBIChatInputExecuteCtx<TNamespace extends NamespaceEnums> exte
7
7
  interaction: Discord.ChatInputCommandInteraction<"cached">;
8
8
  }
9
9
 
10
- export type TDBIChatInputOmitted<TNamespace extends NamespaceEnums> = Omit<DBIChatInput<TNamespace>, "type" | "dbi" | "toJSON">;
10
+ export type TDBIChatInputOmitted<TNamespace extends NamespaceEnums> = Omit<DBIChatInput<TNamespace>, "type" | "dbi" | "ttl" | "toJSON">;
11
11
 
12
12
  export class DBIChatInput<TNamespace extends NamespaceEnums> extends DBIBaseInteraction<TNamespace> {
13
13
  constructor(dbi: DBI<TNamespace, {}>, cfg: TDBIChatInputOmitted<TNamespace>) {
@@ -100,7 +100,7 @@ export type DBIEventCombinations<TNamespace extends NamespaceEnums> = {
100
100
  }
101
101
  }[keyof (ClientEvents) | keyof NamespaceData[TNamespace]["customEvents"]];
102
102
 
103
- export type TDBIEventOmitted<TNamespace extends NamespaceEnums> = Omit<DBIEvent<TNamespace>, "type" | "name" | "onExecute" | "client" | "dbi" | "toggle" | "disabled"> & { disabled?: boolean } & DBIEventCombinations<TNamespace>;
103
+ export type TDBIEventOmitted<TNamespace extends NamespaceEnums> = Omit<DBIEvent<TNamespace>, "type" | "name" | "onExecute" | "client" | "dbi" | "toggle" | "disabled" | "at"> & { disabled?: boolean } & DBIEventCombinations<TNamespace>;
104
104
 
105
105
  export class DBIEvent<TNamespace extends NamespaceEnums> {
106
106
  readonly type: "Event";
@@ -113,6 +113,8 @@ export class DBIEvent<TNamespace extends NamespaceEnums> {
113
113
  dbi: DBI<TNamespace>;
114
114
  disabled: boolean = false;
115
115
  flag?: string;
116
+ at?: number;
117
+ ttl?: number;
116
118
  constructor(dbi: DBI<TNamespace>, cfg: TDBIEventOmitted<TNamespace>) {
117
119
  this.dbi = dbi;
118
120
  this.type = "Event";
@@ -124,6 +126,8 @@ export class DBIEvent<TNamespace extends NamespaceEnums> {
124
126
  this.triggerType = cfg.triggerType ?? "OneByOneGlobal";
125
127
  this.disabled ??= cfg.disabled;
126
128
  this.flag = cfg.flag;
129
+ this.at = Date.now();
130
+ this.ttl = cfg.ttl;
127
131
  }
128
132
 
129
133
  toggle(disabled?: boolean) {
@@ -63,7 +63,7 @@ export type DBIRateLimit = {
63
63
  }
64
64
 
65
65
  export class DBIBaseInteraction<TNamespace extends NamespaceEnums> {
66
- constructor(dbi: DBI<TNamespace>, cfg: Omit<DBIBaseInteraction<TNamespace>, "dbi">) {
66
+ constructor(dbi: DBI<TNamespace>, cfg: Omit<DBIBaseInteraction<TNamespace>, "dbi" | "at">) {
67
67
  this.dbi = dbi;
68
68
  this.name = cfg.name;
69
69
  this.description = cfg.description;
@@ -74,6 +74,8 @@ export class DBIBaseInteraction<TNamespace extends NamespaceEnums> {
74
74
  this.publish = cfg.publish ?? dbi.data.clients.first()?.namespace;
75
75
  this.rateLimits = cfg.rateLimits ?? [];
76
76
  this.flag = cfg.flag;
77
+ this.at = Date.now();
78
+ this.ttl = cfg.ttl;
77
79
  }
78
80
 
79
81
  publish?: NamespaceData[TNamespace]["clientNamespaces"];
@@ -85,6 +87,8 @@ export class DBIBaseInteraction<TNamespace extends NamespaceEnums> {
85
87
  other?: Record<string, any> & { messageCommand?: { aliases?: string[] } };
86
88
  rateLimits?: DBIRateLimit[];
87
89
  flag?: string;
90
+ ttl?: number;
91
+ at?: number;
88
92
  toJSON(overrides: any): any { }
89
93
 
90
94
  onExecute(ctx: IDBIBaseExecuteCtx<TNamespace>): Promise<void> | void {
@@ -319,7 +319,7 @@ export class FakeMessageInteraction /* implements ChatInputCommandInteraction */
319
319
 
320
320
  async deferReply(options: any): Promise<any> {
321
321
  if (this.repliedMessage) throw new Error("Already deferred reply.");
322
- this.repliedMessage = await this.message.reply(options?.content ?? "Loading...");
322
+ this.repliedMessage = await this.message.reply(options?.content ?? (await this.dbi.config.defaults.messageCommands.deferReplyContent(this)));
323
323
  this.deferred = true;
324
324
  this._lastAction = "deferReply";
325
325
  return this.repliedMessage;