@mostfeatured/dbi 0.0.67 → 0.0.68
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/DBI.d.ts +181 -181
- package/dist/DBI.js +369 -369
- package/dist/Events.d.ts +47 -47
- package/dist/index.d.ts +16 -16
- package/dist/index.js +29 -29
- package/dist/methods/hookEventListeners.js +97 -97
- package/dist/methods/hookInteractionListeners.js +129 -129
- package/dist/methods/publishInteractions.d.ts +8 -8
- package/dist/methods/publishInteractions.js +241 -241
- package/dist/methods/publishInteractions.js.map +1 -1
- package/dist/types/CustomEvent.js +19 -19
- package/dist/types/Event.d.ts +265 -265
- package/dist/types/Event.js +24 -24
- package/dist/types/Interaction.d.ts +49 -49
- package/dist/types/Interaction.js +26 -26
- package/dist/utils/recursiveImport.d.ts +5 -5
- package/dist/utils/recursiveImport.js +27 -27
- package/package.json +1 -1
- package/src/methods/publishInteractions.ts +2 -2
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
import Discord from "discord.js";
|
|
2
|
-
import { NamespaceEnums, NamespaceData } from "../../generated/namespaceData";
|
|
3
|
-
import { DBI } from "../DBI";
|
|
4
|
-
import { DBIButton } from "./Button";
|
|
5
|
-
import { DBIChatInput } from "./ChatInput/ChatInput";
|
|
6
|
-
import { DBILocale } from "./Locale";
|
|
7
|
-
import { DBIMessageContextMenu } from "./MessageContextMenu";
|
|
8
|
-
import { DBIModal } from "./Modal";
|
|
9
|
-
import { DBISelectMenu } from "./SelectMenu";
|
|
10
|
-
import { DBIUserContextMenu } from "./UserContextMenu";
|
|
11
|
-
export declare type TDBIInteractions<TNamespace extends NamespaceEnums> = DBIChatInput<TNamespace> | DBIButton<TNamespace> | DBISelectMenu<TNamespace> | DBIMessageContextMenu<TNamespace> | DBIUserContextMenu<TNamespace> | DBIModal<TNamespace>;
|
|
12
|
-
export interface IDBIBaseExecuteCtx<TNamespace extends NamespaceEnums> {
|
|
13
|
-
interaction: Discord.ChatInputCommandInteraction | Discord.UserContextMenuCommandInteraction | Discord.MessageContextMenuCommandInteraction | Discord.ModalSubmitInteraction | Discord.AutocompleteInteraction | Discord.SelectMenuInteraction | Discord.ButtonInteraction;
|
|
14
|
-
locale: {
|
|
15
|
-
user: DBILocale<TNamespace>;
|
|
16
|
-
guild?: DBILocale<TNamespace>;
|
|
17
|
-
};
|
|
18
|
-
dbi: DBI<TNamespace>;
|
|
19
|
-
dbiInteraction: TDBIInteractions<TNamespace>;
|
|
20
|
-
setRateLimit(type: TDBIRateLimitTypes, duration: number): Promise<any>;
|
|
21
|
-
other: Record<string, any>;
|
|
22
|
-
clientNamespace: NamespaceData[TNamespace]["clientNamespaces"];
|
|
23
|
-
}
|
|
24
|
-
export declare type TDBIReferencedData = ({
|
|
25
|
-
[key: string]: any;
|
|
26
|
-
$ref: string;
|
|
27
|
-
$unRef(): boolean;
|
|
28
|
-
} | string | number);
|
|
29
|
-
export declare type TDBIInteractionTypes = "ChatInput" | "UserContextMenu" | "MessageContextMenu" | "Modal" | "Autocomplete" | "SelectMenu" | "Button";
|
|
30
|
-
export declare type TDBIRateLimitTypes = "User" | "Channel" | "Guild" | "Member" | "Message";
|
|
31
|
-
export declare type DBIRateLimit = {
|
|
32
|
-
type: TDBIRateLimitTypes;
|
|
33
|
-
/**
|
|
34
|
-
* Duration in milliseconds.
|
|
35
|
-
*/
|
|
36
|
-
duration: number;
|
|
37
|
-
};
|
|
38
|
-
export declare class DBIBaseInteraction<TNamespace extends NamespaceEnums> {
|
|
39
|
-
constructor(dbi: DBI<TNamespace>, cfg: Omit<DBIBaseInteraction<TNamespace>, "dbi">);
|
|
40
|
-
publish?: NamespaceData[TNamespace]["clientNamespaces"];
|
|
41
|
-
dbi: DBI<TNamespace>;
|
|
42
|
-
name: string;
|
|
43
|
-
description: string;
|
|
44
|
-
readonly type: TDBIInteractionTypes;
|
|
45
|
-
options?: any | any[];
|
|
46
|
-
other?: Record<string, any>;
|
|
47
|
-
rateLimits?: DBIRateLimit[];
|
|
48
|
-
onExecute(ctx: IDBIBaseExecuteCtx<TNamespace>): Promise<void> | void;
|
|
49
|
-
}
|
|
1
|
+
import Discord from "discord.js";
|
|
2
|
+
import { NamespaceEnums, NamespaceData } from "../../generated/namespaceData";
|
|
3
|
+
import { DBI } from "../DBI";
|
|
4
|
+
import { DBIButton } from "./Button";
|
|
5
|
+
import { DBIChatInput } from "./ChatInput/ChatInput";
|
|
6
|
+
import { DBILocale } from "./Locale";
|
|
7
|
+
import { DBIMessageContextMenu } from "./MessageContextMenu";
|
|
8
|
+
import { DBIModal } from "./Modal";
|
|
9
|
+
import { DBISelectMenu } from "./SelectMenu";
|
|
10
|
+
import { DBIUserContextMenu } from "./UserContextMenu";
|
|
11
|
+
export declare type TDBIInteractions<TNamespace extends NamespaceEnums> = DBIChatInput<TNamespace> | DBIButton<TNamespace> | DBISelectMenu<TNamespace> | DBIMessageContextMenu<TNamespace> | DBIUserContextMenu<TNamespace> | DBIModal<TNamespace>;
|
|
12
|
+
export interface IDBIBaseExecuteCtx<TNamespace extends NamespaceEnums> {
|
|
13
|
+
interaction: Discord.ChatInputCommandInteraction | Discord.UserContextMenuCommandInteraction | Discord.MessageContextMenuCommandInteraction | Discord.ModalSubmitInteraction | Discord.AutocompleteInteraction | Discord.SelectMenuInteraction | Discord.ButtonInteraction;
|
|
14
|
+
locale: {
|
|
15
|
+
user: DBILocale<TNamespace>;
|
|
16
|
+
guild?: DBILocale<TNamespace>;
|
|
17
|
+
};
|
|
18
|
+
dbi: DBI<TNamespace>;
|
|
19
|
+
dbiInteraction: TDBIInteractions<TNamespace>;
|
|
20
|
+
setRateLimit(type: TDBIRateLimitTypes, duration: number): Promise<any>;
|
|
21
|
+
other: Record<string, any>;
|
|
22
|
+
clientNamespace: NamespaceData[TNamespace]["clientNamespaces"];
|
|
23
|
+
}
|
|
24
|
+
export declare type TDBIReferencedData = ({
|
|
25
|
+
[key: string]: any;
|
|
26
|
+
$ref: string;
|
|
27
|
+
$unRef(): boolean;
|
|
28
|
+
} | string | number);
|
|
29
|
+
export declare type TDBIInteractionTypes = "ChatInput" | "UserContextMenu" | "MessageContextMenu" | "Modal" | "Autocomplete" | "SelectMenu" | "Button";
|
|
30
|
+
export declare type TDBIRateLimitTypes = "User" | "Channel" | "Guild" | "Member" | "Message";
|
|
31
|
+
export declare type DBIRateLimit = {
|
|
32
|
+
type: TDBIRateLimitTypes;
|
|
33
|
+
/**
|
|
34
|
+
* Duration in milliseconds.
|
|
35
|
+
*/
|
|
36
|
+
duration: number;
|
|
37
|
+
};
|
|
38
|
+
export declare class DBIBaseInteraction<TNamespace extends NamespaceEnums> {
|
|
39
|
+
constructor(dbi: DBI<TNamespace>, cfg: Omit<DBIBaseInteraction<TNamespace>, "dbi">);
|
|
40
|
+
publish?: NamespaceData[TNamespace]["clientNamespaces"];
|
|
41
|
+
dbi: DBI<TNamespace>;
|
|
42
|
+
name: string;
|
|
43
|
+
description: string;
|
|
44
|
+
readonly type: TDBIInteractionTypes;
|
|
45
|
+
options?: any | any[];
|
|
46
|
+
other?: Record<string, any>;
|
|
47
|
+
rateLimits?: DBIRateLimit[];
|
|
48
|
+
onExecute(ctx: IDBIBaseExecuteCtx<TNamespace>): Promise<void> | void;
|
|
49
|
+
}
|
|
50
50
|
//# sourceMappingURL=Interaction.d.ts.map
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DBIBaseInteraction = void 0;
|
|
4
|
-
class DBIBaseInteraction {
|
|
5
|
-
constructor(dbi, cfg) {
|
|
6
|
-
this.dbi = dbi;
|
|
7
|
-
this.name = cfg.name;
|
|
8
|
-
this.description = cfg.description;
|
|
9
|
-
this.onExecute = cfg.onExecute;
|
|
10
|
-
this.type = cfg.type;
|
|
11
|
-
this.options = cfg.options;
|
|
12
|
-
this.other = cfg.other;
|
|
13
|
-
this.publish = cfg.publish ?? dbi.data.clients.first()?.namespace;
|
|
14
|
-
}
|
|
15
|
-
publish;
|
|
16
|
-
dbi;
|
|
17
|
-
name;
|
|
18
|
-
description;
|
|
19
|
-
type;
|
|
20
|
-
options;
|
|
21
|
-
other;
|
|
22
|
-
rateLimits;
|
|
23
|
-
onExecute(ctx) {
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
exports.DBIBaseInteraction = DBIBaseInteraction;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DBIBaseInteraction = void 0;
|
|
4
|
+
class DBIBaseInteraction {
|
|
5
|
+
constructor(dbi, cfg) {
|
|
6
|
+
this.dbi = dbi;
|
|
7
|
+
this.name = cfg.name;
|
|
8
|
+
this.description = cfg.description;
|
|
9
|
+
this.onExecute = cfg.onExecute;
|
|
10
|
+
this.type = cfg.type;
|
|
11
|
+
this.options = cfg.options;
|
|
12
|
+
this.other = cfg.other;
|
|
13
|
+
this.publish = cfg.publish ?? dbi.data.clients.first()?.namespace;
|
|
14
|
+
}
|
|
15
|
+
publish;
|
|
16
|
+
dbi;
|
|
17
|
+
name;
|
|
18
|
+
description;
|
|
19
|
+
type;
|
|
20
|
+
options;
|
|
21
|
+
other;
|
|
22
|
+
rateLimits;
|
|
23
|
+
onExecute(ctx) {
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.DBIBaseInteraction = DBIBaseInteraction;
|
|
27
27
|
//# sourceMappingURL=Interaction.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @example
|
|
3
|
-
* await recursiveImport("./src", [".js"], [".d.ts"])
|
|
4
|
-
*/
|
|
5
|
-
export declare function recursiveImport(folderPath: string, exts?: string[], ignore?: string[]): Promise<any>;
|
|
1
|
+
/**
|
|
2
|
+
* @example
|
|
3
|
+
* await recursiveImport("./src", [".js"], [".d.ts"])
|
|
4
|
+
*/
|
|
5
|
+
export declare function recursiveImport(folderPath: string, exts?: string[], ignore?: string[]): Promise<any>;
|
|
6
6
|
//# sourceMappingURL=recursiveImport.d.ts.map
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.recursiveImport = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
6
|
-
const path_1 = tslib_1.__importDefault(require("path"));
|
|
7
|
-
/**
|
|
8
|
-
* @example
|
|
9
|
-
* await recursiveImport("./src", [".js"], [".d.ts"])
|
|
10
|
-
*/
|
|
11
|
-
async function recursiveImport(folderPath, exts = [".js"], ignore = [".d.ts", ".js.map", ".d.ts.map"]) {
|
|
12
|
-
let files = await fs_1.default.promises.readdir(folderPath, { withFileTypes: true });
|
|
13
|
-
let dirName = __dirname;
|
|
14
|
-
for (const file of files) {
|
|
15
|
-
let filePath = path_1.default.resolve(folderPath, file.name);
|
|
16
|
-
let relative = path_1.default.relative(dirName, filePath);
|
|
17
|
-
if (!relative.includes(`${path_1.default.sep}-`)) {
|
|
18
|
-
if (file.isDirectory()) {
|
|
19
|
-
await recursiveImport(filePath, exts);
|
|
20
|
-
}
|
|
21
|
-
else if (exts.some(i => file.name.endsWith(i)) && !ignore.some(i => file.name.endsWith(i))) {
|
|
22
|
-
await Promise.resolve().then(() => tslib_1.__importStar(require(filePath)));
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
exports.recursiveImport = recursiveImport;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.recursiveImport = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
6
|
+
const path_1 = tslib_1.__importDefault(require("path"));
|
|
7
|
+
/**
|
|
8
|
+
* @example
|
|
9
|
+
* await recursiveImport("./src", [".js"], [".d.ts"])
|
|
10
|
+
*/
|
|
11
|
+
async function recursiveImport(folderPath, exts = [".js"], ignore = [".d.ts", ".js.map", ".d.ts.map"]) {
|
|
12
|
+
let files = await fs_1.default.promises.readdir(folderPath, { withFileTypes: true });
|
|
13
|
+
let dirName = __dirname;
|
|
14
|
+
for (const file of files) {
|
|
15
|
+
let filePath = path_1.default.resolve(folderPath, file.name);
|
|
16
|
+
let relative = path_1.default.relative(dirName, filePath);
|
|
17
|
+
if (!relative.includes(`${path_1.default.sep}-`)) {
|
|
18
|
+
if (file.isDirectory()) {
|
|
19
|
+
await recursiveImport(filePath, exts);
|
|
20
|
+
}
|
|
21
|
+
else if (exts.some(i => file.name.endsWith(i)) && !ignore.some(i => file.name.endsWith(i))) {
|
|
22
|
+
await Promise.resolve().then(() => tslib_1.__importStar(require(filePath)));
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.recursiveImport = recursiveImport;
|
|
28
28
|
//# sourceMappingURL=recursiveImport.js.map
|
package/package.json
CHANGED
|
@@ -176,11 +176,11 @@ export async function publishInteractions(
|
|
|
176
176
|
|
|
177
177
|
switch (publishType) {
|
|
178
178
|
case "Guild": {
|
|
179
|
-
await rest.put(Routes.applicationGuildCommands(me.id, guildId), { body: body[client.namespace] });
|
|
179
|
+
await rest.put(Routes.applicationGuildCommands(me.id, guildId), { body: body[client.namespace] || [] });
|
|
180
180
|
break;
|
|
181
181
|
}
|
|
182
182
|
case "Global": {
|
|
183
|
-
await rest.put(Routes.applicationCommands(me.id), { body: body[client.namespace] });
|
|
183
|
+
await rest.put(Routes.applicationCommands(me.id), { body: body[client.namespace] || [] });
|
|
184
184
|
break;
|
|
185
185
|
}
|
|
186
186
|
}
|