@mostfeatured/dbi 0.0.69 → 0.0.70-dev.0
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/.hintrc +8 -0
- package/dist/DBI.d.ts +1 -1
- package/dist/DBI.d.ts.map +1 -1
- package/dist/DBI.js +369 -369
- package/dist/DBI.js.map +1 -1
- package/dist/data/eventMap.json +10 -0
- package/dist/methods/publishInteractions.d.ts.map +1 -1
- package/dist/methods/publishInteractions.js.map +1 -1
- package/dist/types/ApplicationRoleConnectionMetadata.d.ts +23 -0
- package/dist/types/ApplicationRoleConnectionMetadata.d.ts.map +1 -0
- package/dist/types/ApplicationRoleConnectionMetadata.js +15 -0
- package/dist/types/ApplicationRoleConnectionMetadata.js.map +1 -0
- package/dist/types/Event.d.ts +10 -0
- package/dist/types/Event.d.ts.map +1 -1
- package/dist/types/Event.js.map +1 -1
- package/dist/types/SelectMenu.d.ts +2 -1
- package/dist/types/SelectMenu.d.ts.map +1 -1
- package/dist/types/SelectMenu.js +1 -1
- package/dist/types/SelectMenu.js.map +1 -1
- package/dist/types/SelectMenuBuilder.d.ts +2 -2
- package/dist/types/SelectMenuBuilder.d.ts.map +1 -1
- package/dist/types/SelectMenuBuilder.js.map +1 -1
- package/package.json +7 -5
- package/src/DBI.ts +4 -4
- package/src/data/eventMap.json +10 -0
- package/src/methods/publishInteractions.ts +1 -0
- package/src/types/ApplicationRoleConnectionMetadata.ts +19 -0
- package/src/types/Event.ts +3 -0
- package/src/types/SelectMenu.ts +4 -3
- package/src/types/SelectMenuBuilder.ts +2 -2
package/src/DBI.ts
CHANGED
|
@@ -138,7 +138,7 @@ export class DBI<TNamespace extends NamespaceEnums, TOtherData = Record<string,
|
|
|
138
138
|
}
|
|
139
139
|
};
|
|
140
140
|
events: Events<TNamespace>;
|
|
141
|
-
cluster?: Sharding.Client
|
|
141
|
+
cluster?: Sharding.ClusterClient<Discord.Client>;
|
|
142
142
|
private _loaded: boolean;
|
|
143
143
|
private _hooked: boolean;
|
|
144
144
|
constructor(namespace: TNamespace, config: DBIConfigConstructor) {
|
|
@@ -209,8 +209,8 @@ export class DBI<TNamespace extends NamespaceEnums, TOtherData = Record<string,
|
|
|
209
209
|
let client = new Discord.Client({
|
|
210
210
|
...(clientContext.options || {}) as any,
|
|
211
211
|
...(config.sharding == "hybrid" ? {
|
|
212
|
-
shards: (
|
|
213
|
-
shardCount: (
|
|
212
|
+
shards: Sharding.getInfo().SHARD_LIST,
|
|
213
|
+
shardCount: Sharding.getInfo().TOTAL_SHARDS
|
|
214
214
|
} : {})
|
|
215
215
|
});
|
|
216
216
|
clientContext.client = client;
|
|
@@ -220,7 +220,7 @@ export class DBI<TNamespace extends NamespaceEnums, TOtherData = Record<string,
|
|
|
220
220
|
if (this.data.clients.length !== 1 && !(config.sharding && config.sharding === "off"))
|
|
221
221
|
throw new Error("Sharding only supports 1 client.");
|
|
222
222
|
|
|
223
|
-
this.cluster = config.sharding == "hybrid" ? new Sharding.
|
|
223
|
+
this.cluster = config.sharding == "hybrid" ? new Sharding.ClusterClient(this.data.clients[0].client) : undefined;
|
|
224
224
|
this._loaded = false;
|
|
225
225
|
this._hooked = false;
|
|
226
226
|
}
|
package/src/data/eventMap.json
CHANGED
|
@@ -230,5 +230,15 @@
|
|
|
230
230
|
"guildScheduledEventUserRemove": [
|
|
231
231
|
"guildScheduledEvent",
|
|
232
232
|
"user"
|
|
233
|
+
],
|
|
234
|
+
"autoModerationRuleCreate": [
|
|
235
|
+
"autoModerationRule"
|
|
236
|
+
],
|
|
237
|
+
"autoModerationRuleDelete": [
|
|
238
|
+
"autoModerationRule"
|
|
239
|
+
],
|
|
240
|
+
"autoModerationRuleUpdate": [
|
|
241
|
+
"oldAutoModerationRule",
|
|
242
|
+
"newAutoModerationRule"
|
|
233
243
|
]
|
|
234
244
|
}
|
|
@@ -7,6 +7,7 @@ import snakecaseKeys from "snakecase-keys";
|
|
|
7
7
|
import { DBI, DBIClientData } from "../DBI";
|
|
8
8
|
import { DBIInteractionLocale } from "../types/InteractionLocale";
|
|
9
9
|
import { NamespaceEnums } from "../../generated/namespaceData";
|
|
10
|
+
import { ApplicationRoleConnectionMetadataType, ApplicationRoleConnectionMetadata } from "../types/ApplicationRoleConnectionMetadata";
|
|
10
11
|
|
|
11
12
|
const PUBLISHABLE_TYPES = ["ChatInput", "UserContextMenu", "MessageContextMenu"];
|
|
12
13
|
const ORIGINAL_LOCALES = ["da", "de", "en-GB", "en-US", "es-ES", "fr", "hr", "it", "lt", "hu", "nl", "no", "pl", "pt-BR", "ro", "fi", "sv-SE", "vi", "tr", "cs", "el", "bg", "ru", "uk", "hi", "th", "zh-CN", "ja", "zh-TW", "ko"];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export enum ApplicationRoleConnectionMetadataType {
|
|
2
|
+
INTEGER_LESS_THAN_OR_EQUAL = 1,
|
|
3
|
+
INTEGER_GREATER_THAN_OR_EQUAL = 2,
|
|
4
|
+
INTEGER_EQUAL = 3,
|
|
5
|
+
INTEGER_NOT_EQUAL = 4,
|
|
6
|
+
DATETIME_LESS_THAN_OR_EQUAL = 5,
|
|
7
|
+
DATETIME_GREATER_THAN_OR_EQUAL = 6,
|
|
8
|
+
BOOLEAN_EQUAL = 7,
|
|
9
|
+
BOOLEAN_NOT_EQUAL = 8,
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface ApplicationRoleConnectionMetadata {
|
|
13
|
+
type: ApplicationRoleConnectionMetadataType;
|
|
14
|
+
key: string;
|
|
15
|
+
name: string;
|
|
16
|
+
name_localizations?: { [key: string]: string };
|
|
17
|
+
description: string;
|
|
18
|
+
description_localizations?: { [key: string]: string };
|
|
19
|
+
}
|
package/src/types/Event.ts
CHANGED
|
@@ -88,6 +88,9 @@ export interface ClientEvents {
|
|
|
88
88
|
guildScheduledEventDelete: { guildScheduledEvent: Discord.GuildScheduledEvent };
|
|
89
89
|
guildScheduledEventUserAdd: { guildScheduledEvent: Discord.GuildScheduledEvent, user: Discord.User };
|
|
90
90
|
guildScheduledEventUserRemove: { guildScheduledEvent: Discord.GuildScheduledEvent, user: Discord.User };
|
|
91
|
+
autoModerationRuleCreate: { autoModerationRule: Discord.AutoModerationRule; };
|
|
92
|
+
autoModerationRuleDelete: { autoModerationRule: Discord.AutoModerationRule; };
|
|
93
|
+
autoModerationRuleUpdate: { oldAutoModerationRule: Discord.AutoModerationRule | null; newAutoModerationRule: Discord.AutoModerationRule; };
|
|
91
94
|
}
|
|
92
95
|
|
|
93
96
|
export type DBIEventCombinations<TNamespace extends NamespaceEnums> = {
|
package/src/types/SelectMenu.ts
CHANGED
|
@@ -7,7 +7,6 @@ import { NamespaceEnums } from "../../generated/namespaceData";
|
|
|
7
7
|
import stuffs from "stuffs";
|
|
8
8
|
import { DBISelectMenuBuilder, DBISelectMenuOverrides } from "./SelectMenuBuilder";
|
|
9
9
|
|
|
10
|
-
|
|
11
10
|
export interface IDBISelectMenuExecuteCtx<TNamespace extends NamespaceEnums> extends IDBIBaseExecuteCtx<TNamespace> {
|
|
12
11
|
interaction: Discord.ButtonInteraction<"cached">;
|
|
13
12
|
data: TDBIReferencedData[];
|
|
@@ -15,6 +14,8 @@ export interface IDBISelectMenuExecuteCtx<TNamespace extends NamespaceEnums> ext
|
|
|
15
14
|
|
|
16
15
|
export type TDBISelectMenuOmitted<TNamespace extends NamespaceEnums> = Omit<DBISelectMenu<TNamespace>, "type" | "description" | "dbi" | "toJSON" | "createBuilder">;
|
|
17
16
|
|
|
17
|
+
export type SelectMenuDefaultOptions = Required<Pick<Discord.StringSelectMenuComponentData, "options">> & Omit<Discord.StringSelectMenuComponentData, "customId" | "type" | "options">;
|
|
18
|
+
|
|
18
19
|
export class DBISelectMenu<TNamespace extends NamespaceEnums> extends DBIBaseInteraction<TNamespace> {
|
|
19
20
|
constructor(dbi: DBI<TNamespace>, args: TDBISelectMenuOmitted<TNamespace>) {
|
|
20
21
|
super(dbi, {
|
|
@@ -23,7 +24,7 @@ export class DBISelectMenu<TNamespace extends NamespaceEnums> extends DBIBaseInt
|
|
|
23
24
|
});
|
|
24
25
|
}
|
|
25
26
|
|
|
26
|
-
declare options:
|
|
27
|
+
declare options: SelectMenuDefaultOptions;
|
|
27
28
|
|
|
28
29
|
override onExecute(ctx: IDBISelectMenuExecuteCtx<TNamespace>): Promise<void> | void { };
|
|
29
30
|
|
|
@@ -31,7 +32,7 @@ export class DBISelectMenu<TNamespace extends NamespaceEnums> extends DBIBaseInt
|
|
|
31
32
|
return {
|
|
32
33
|
...stuffs.defaultify((arg?.overrides || {}), this.options || {}, true),
|
|
33
34
|
customId: buildCustomId(this.dbi as any, this.name, arg?.reference?.data || [], arg?.reference?.ttl),
|
|
34
|
-
type: Discord.ComponentType.
|
|
35
|
+
type: Discord.ComponentType.StringSelect,
|
|
35
36
|
} as any;
|
|
36
37
|
};
|
|
37
38
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { BaseSelectMenuComponentData } from "discord.js";
|
|
1
|
+
import { BaseSelectMenuComponentData, StringSelectMenuComponentData } from "discord.js";
|
|
2
2
|
import { defaultify } from "stuffs";
|
|
3
3
|
import { NamespaceEnums } from "../../generated/namespaceData";
|
|
4
4
|
import { DBISelectMenu } from "./SelectMenu";
|
|
5
5
|
|
|
6
|
-
export type DBISelectMenuOverrides =
|
|
6
|
+
export type DBISelectMenuOverrides = Omit<StringSelectMenuComponentData, "customId" | "type">
|
|
7
7
|
|
|
8
8
|
export class DBISelectMenuBuilder<TNamespace extends NamespaceEnums> {
|
|
9
9
|
component: DBISelectMenu<TNamespace>
|