xernerx 4.5.6 → 4.5.8
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/build/XernerxContextCommand.d.ts +46 -46
- package/dist/build/XernerxContextCommand.d.ts.map +1 -1
- package/dist/build/XernerxContextCommand.js +63 -63
- package/dist/build/XernerxContextCommand.js.map +1 -1
- package/dist/build/XernerxEvent.d.ts +16 -15
- package/dist/build/XernerxEvent.d.ts.map +1 -1
- package/dist/build/XernerxEvent.js +20 -20
- package/dist/build/XernerxEvent.js.map +1 -1
- package/dist/build/XernerxInhibitor.d.ts +19 -19
- package/dist/build/XernerxInhibitor.d.ts.map +1 -1
- package/dist/build/XernerxInhibitor.js +12 -12
- package/dist/build/XernerxInhibitor.js.map +1 -1
- package/dist/build/XernerxMessageCommand.d.ts +44 -44
- package/dist/build/XernerxMessageCommand.d.ts.map +1 -1
- package/dist/build/XernerxMessageCommand.js +57 -57
- package/dist/build/XernerxMessageCommand.js.map +1 -1
- package/dist/build/XernerxSlashCommand.d.ts +56 -56
- package/dist/build/XernerxSlashCommand.d.ts.map +1 -1
- package/dist/build/XernerxSlashCommand.js +109 -109
- package/dist/build/XernerxSlashCommand.js.map +1 -1
- package/dist/client/XernerxClient.d.ts +45 -44
- package/dist/client/XernerxClient.d.ts.map +1 -1
- package/dist/client/XernerxClient.js +74 -73
- package/dist/client/XernerxClient.js.map +1 -1
- package/dist/client/XernerxShardClient.d.ts +11 -10
- package/dist/client/XernerxShardClient.d.ts.map +1 -1
- package/dist/client/XernerxShardClient.js +49 -48
- package/dist/client/XernerxShardClient.js.map +1 -1
- package/dist/functions/deploy.d.ts +1 -0
- package/dist/functions/deploy.d.ts.map +1 -1
- package/dist/functions/deploy.js +31 -30
- package/dist/functions/deploy.js.map +1 -1
- package/dist/functions/load.d.ts +1 -0
- package/dist/functions/load.d.ts.map +1 -1
- package/dist/functions/load.js +28 -27
- package/dist/functions/load.js.map +1 -1
- package/dist/functions/reload.d.ts +1 -0
- package/dist/functions/reload.d.ts.map +1 -1
- package/dist/functions/reload.js +35 -34
- package/dist/functions/reload.js.map +1 -1
- package/dist/functions/sendWebhook.d.ts +1 -0
- package/dist/functions/sendWebhook.d.ts.map +1 -1
- package/dist/functions/sendWebhook.js +11 -10
- package/dist/functions/sendWebhook.js.map +1 -1
- package/dist/functions/setPresence.d.ts +1 -0
- package/dist/functions/setPresence.d.ts.map +1 -1
- package/dist/functions/setPresence.js +18 -17
- package/dist/functions/setPresence.js.map +1 -1
- package/dist/functions/xernerxUser.d.ts +1 -0
- package/dist/functions/xernerxUser.d.ts.map +1 -1
- package/dist/functions/xernerxUser.js +6 -8
- package/dist/functions/xernerxUser.js.map +1 -1
- package/dist/handlers/CommandHandler.d.ts +9 -8
- package/dist/handlers/CommandHandler.d.ts.map +1 -1
- package/dist/handlers/CommandHandler.js +240 -239
- package/dist/handlers/CommandHandler.js.map +1 -1
- package/dist/handlers/EventHandler.d.ts +3 -2
- package/dist/handlers/EventHandler.d.ts.map +1 -1
- package/dist/handlers/EventHandler.js +19 -18
- package/dist/handlers/EventHandler.js.map +1 -1
- package/dist/handlers/ExtensionHandler.d.ts +3 -2
- package/dist/handlers/ExtensionHandler.d.ts.map +1 -1
- package/dist/handlers/ExtensionHandler.js +18 -17
- package/dist/handlers/ExtensionHandler.js.map +1 -1
- package/dist/handlers/Handler.d.ts +8 -7
- package/dist/handlers/Handler.d.ts.map +1 -1
- package/dist/handlers/Handler.js +32 -31
- package/dist/handlers/Handler.js.map +1 -1
- package/dist/handlers/InhibitorHandler.d.ts +3 -2
- package/dist/handlers/InhibitorHandler.d.ts.map +1 -1
- package/dist/handlers/InhibitorHandler.js +19 -18
- package/dist/handlers/InhibitorHandler.js.map +1 -1
- package/dist/handlers/WebhookHandler.d.ts +4 -3
- package/dist/handlers/WebhookHandler.d.ts.map +1 -1
- package/dist/handlers/WebhookHandler.js +47 -46
- package/dist/handlers/WebhookHandler.js.map +1 -1
- package/dist/main.d.ts +27 -26
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +27 -26
- package/dist/main.js.map +1 -1
- package/dist/models/Arguments.d.ts +3 -2
- package/dist/models/Arguments.d.ts.map +1 -1
- package/dist/models/Arguments.js +135 -134
- package/dist/models/Arguments.js.map +1 -1
- package/dist/tools/XernerxError.d.ts +5 -4
- package/dist/tools/XernerxError.d.ts.map +1 -1
- package/dist/tools/XernerxError.js +9 -8
- package/dist/tools/XernerxError.js.map +1 -1
- package/dist/tools/XernerxLog.d.ts +13 -12
- package/dist/tools/XernerxLog.d.ts.map +1 -1
- package/dist/tools/XernerxLog.js +76 -80
- package/dist/tools/XernerxLog.js.map +1 -1
- package/dist/types/extenders.d.ts +43 -12
- package/dist/types/extenders.d.ts.map +1 -1
- package/dist/types/extenders.js +1 -0
- package/dist/types/extenders.js.map +1 -1
- package/dist/types/interfaces.d.ts +186 -172
- package/dist/types/interfaces.d.ts.map +1 -1
- package/dist/types/interfaces.js +1 -0
- package/dist/types/interfaces.js.map +1 -1
- package/dist/types/types.d.ts +172 -171
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/types.js +1 -0
- package/dist/types/types.js.map +1 -1
- package/dist/utils/ClientUtil.d.ts +13 -6
- package/dist/utils/ClientUtil.d.ts.map +1 -1
- package/dist/utils/ClientUtil.js +56 -26
- package/dist/utils/ClientUtil.js.map +1 -1
- package/dist/utils/InteractionUtil.d.ts +10 -5
- package/dist/utils/InteractionUtil.d.ts.map +1 -1
- package/dist/utils/InteractionUtil.js +97 -8
- package/dist/utils/InteractionUtil.js.map +1 -1
- package/dist/utils/MessageUtil.d.ts +13 -9
- package/dist/utils/MessageUtil.d.ts.map +1 -1
- package/dist/utils/MessageUtil.js +130 -37
- package/dist/utils/MessageUtil.js.map +1 -1
- package/dist/utils/Util.d.ts +4 -3
- package/dist/utils/Util.d.ts.map +1 -1
- package/dist/utils/Util.js +8 -7
- package/dist/utils/Util.js.map +1 -1
- package/dist/validators/commandValidation.d.ts +3 -2
- package/dist/validators/commandValidation.d.ts.map +1 -1
- package/dist/validators/commandValidation.js +43 -42
- package/dist/validators/commandValidation.js.map +1 -1
- package/dist/validators/inhibitorValidations.d.ts +15 -14
- package/dist/validators/inhibitorValidations.d.ts.map +1 -1
- package/dist/validators/inhibitorValidations.js +31 -30
- package/dist/validators/inhibitorValidations.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,51 +1,52 @@
|
|
|
1
|
+
/** @format */
|
|
1
2
|
import { Client, ClientOptions, Collection } from 'discord.js';
|
|
2
3
|
import { XernerxOptions, ModuleOptions, XernerxCommands, XernerxCache } from '../types/interfaces.js';
|
|
3
4
|
import ClientUtil from '../utils/ClientUtil.js';
|
|
4
5
|
import { XernerxInhibitor, XernerxEvent } from '../main.js';
|
|
5
6
|
export default class XernerxClient<T = unknown> extends Client {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
7
|
+
readonly settings: {
|
|
8
|
+
ownerId: (string | string[]) & (string | string[] | undefined);
|
|
9
|
+
local: string;
|
|
10
|
+
global?: boolean | undefined;
|
|
11
|
+
permissions?:
|
|
12
|
+
| {
|
|
13
|
+
client: string[];
|
|
14
|
+
user: string[];
|
|
15
|
+
dm: boolean;
|
|
16
|
+
}
|
|
17
|
+
| undefined;
|
|
18
|
+
ignore?:
|
|
19
|
+
| {
|
|
20
|
+
owner: boolean;
|
|
21
|
+
users: string[];
|
|
22
|
+
channels: string[];
|
|
23
|
+
guilds: string[];
|
|
24
|
+
}
|
|
25
|
+
| undefined;
|
|
26
|
+
log?:
|
|
27
|
+
| {
|
|
28
|
+
ready: boolean;
|
|
29
|
+
error: boolean;
|
|
30
|
+
info: boolean;
|
|
31
|
+
table: string[] | null;
|
|
32
|
+
}
|
|
33
|
+
| undefined;
|
|
34
|
+
cooldown?:
|
|
35
|
+
| {
|
|
36
|
+
command: number;
|
|
37
|
+
cache: number;
|
|
38
|
+
}
|
|
39
|
+
| undefined;
|
|
40
|
+
};
|
|
41
|
+
readonly config: NonNullable<T> | null;
|
|
42
|
+
readonly commands: XernerxCommands;
|
|
43
|
+
readonly events: Collection<string, XernerxEvent>;
|
|
44
|
+
readonly inhibitors: Collection<string, XernerxInhibitor>;
|
|
45
|
+
readonly modules: ModuleOptions;
|
|
46
|
+
readonly util: ClientUtil;
|
|
47
|
+
readonly stats: Record<string, number>;
|
|
48
|
+
readonly cache: XernerxCache;
|
|
49
|
+
constructor(discordOptions: ClientOptions, xernerxOptions: XernerxOptions, config?: T);
|
|
50
|
+
connect(token: string): Promise<string>;
|
|
50
51
|
}
|
|
51
52
|
//# sourceMappingURL=XernerxClient.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"XernerxClient.d.ts","sourceRoot":"","sources":["../../src/client/XernerxClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAQ/D,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtG,OAAO,UAAU,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAI5D,MAAM,CAAC,OAAO,OAAO,aAAa,CAAC,CAAC,GAAG,OAAO,CAAE,SAAQ,MAAM;
|
|
1
|
+
{"version":3,"file":"XernerxClient.d.ts","sourceRoot":"","sources":["../../src/client/XernerxClient.ts"],"names":[],"mappings":"AAAA,cAAc;AAEd,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAQ/D,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtG,OAAO,UAAU,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAI5D,MAAM,CAAC,OAAO,OAAO,aAAa,CAAC,CAAC,GAAG,OAAO,CAAE,SAAQ,MAAM;IAC7D,SAAwB,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;MAAC;IACjC,SAAwB,MAAM,wBAAC;IAC/B,SAAwB,QAAQ,EAAE,eAAe,CAAC;IAClD,SAAwB,MAAM,EAAE,UAAU,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IACjE,SAAwB,UAAU,EAAE,UAAU,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IACzE,SAAwB,OAAO,EAAE,aAAa,CAAC;IAC/C,SAAwB,IAAI,EAAE,UAAU,CAAC;IACzC,SAAwB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtD,SAAwB,KAAK,EAAE,YAAY,CAAC;gBAEzB,cAAc,EAAE,aAAa,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,CAAC,EAAE,CAAC;IA8E/E,OAAO,CAAC,KAAK,EAAE,MAAM;CASlC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/** @format */
|
|
1
2
|
import { Client, Collection } from 'discord.js';
|
|
2
3
|
import { z } from 'zod';
|
|
3
4
|
import CommandHandler from '../handlers/CommandHandler.js';
|
|
@@ -9,78 +10,78 @@ import ClientUtil from '../utils/ClientUtil.js';
|
|
|
9
10
|
import ExtensionHandler from '../handlers/ExtensionHandler.js';
|
|
10
11
|
import deploy from '../functions/deploy.js';
|
|
11
12
|
export default class XernerxClient extends Client {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
13
|
+
constructor(discordOptions, xernerxOptions, config) {
|
|
14
|
+
super(discordOptions);
|
|
15
|
+
this.settings = z
|
|
16
|
+
.object({
|
|
17
|
+
local: z.string(),
|
|
18
|
+
global: z.boolean().default(false).optional(),
|
|
19
|
+
ownerId: z.string().or(z.array(z.string())).default([]),
|
|
20
|
+
permissions: z
|
|
21
|
+
.object({
|
|
22
|
+
client: z.array(z.string()).default([]),
|
|
23
|
+
user: z.array(z.string()).default([]),
|
|
24
|
+
dm: z.boolean().default(false),
|
|
25
|
+
})
|
|
26
|
+
.optional(),
|
|
27
|
+
ignore: z
|
|
28
|
+
.object({
|
|
29
|
+
owner: z.boolean().default(false),
|
|
30
|
+
users: z.array(z.string()).default([]),
|
|
31
|
+
channels: z.array(z.string()).default([]),
|
|
32
|
+
guilds: z.array(z.string()).default([]),
|
|
33
|
+
})
|
|
34
|
+
.optional(),
|
|
35
|
+
log: z
|
|
36
|
+
.object({
|
|
37
|
+
ready: z.boolean().default(false),
|
|
38
|
+
info: z.boolean().default(false),
|
|
39
|
+
error: z.boolean().default(false),
|
|
40
|
+
table: z.array(z.string()).or(z.null()).default(null),
|
|
41
|
+
})
|
|
42
|
+
.optional(),
|
|
43
|
+
cooldown: z
|
|
44
|
+
.object({
|
|
45
|
+
command: z.number().default(0),
|
|
46
|
+
cache: z.number().default(0),
|
|
47
|
+
})
|
|
48
|
+
.optional(),
|
|
49
|
+
})
|
|
50
|
+
.parse(xernerxOptions);
|
|
51
|
+
this.config = config || null;
|
|
52
|
+
this.commands = {
|
|
53
|
+
message: new Collection(),
|
|
54
|
+
slash: new Collection(),
|
|
55
|
+
context: new Collection(),
|
|
56
|
+
};
|
|
57
|
+
this.events = new Collection();
|
|
58
|
+
this.inhibitors = new Collection();
|
|
59
|
+
this.modules = {
|
|
60
|
+
options: {},
|
|
61
|
+
commandHandler: new CommandHandler(this),
|
|
62
|
+
eventHandler: new EventHandler(this),
|
|
63
|
+
inhibitorHandler: new InhibitorHandler(this),
|
|
64
|
+
webhookHandler: new WebhookHandler(this),
|
|
65
|
+
extensionHandler: new ExtensionHandler(this),
|
|
66
|
+
};
|
|
67
|
+
this.util = new ClientUtil(this);
|
|
68
|
+
this.stats = {
|
|
69
|
+
guildCount: this.guilds.cache.size,
|
|
70
|
+
userCount: 0,
|
|
71
|
+
shardId: 0,
|
|
72
|
+
shardCount: 1,
|
|
73
|
+
};
|
|
74
|
+
this.cache = {
|
|
75
|
+
messages: new Collection(),
|
|
76
|
+
cooldowns: new Collection(),
|
|
77
|
+
};
|
|
78
|
+
return this;
|
|
79
|
+
}
|
|
80
|
+
async connect(token) {
|
|
81
|
+
const login = this.login(token);
|
|
82
|
+
deploy(this);
|
|
83
|
+
new XernerxLog(this).ready();
|
|
84
|
+
return login;
|
|
85
|
+
}
|
|
85
86
|
}
|
|
86
87
|
//# sourceMappingURL=XernerxClient.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"XernerxClient.js","sourceRoot":"","sources":["../../src/client/XernerxClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAiB,UAAU,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,cAAc,MAAM,+BAA+B,CAAC;AAC3D,OAAO,YAAY,MAAM,6BAA6B,CAAC;AACvD,OAAO,gBAAgB,MAAM,iCAAiC,CAAC;AAC/D,OAAO,cAAc,MAAM,+BAA+B,CAAC;AAC3D,OAAO,UAAU,MAAM,wBAAwB,CAAC;AAEhD,OAAO,UAAU,MAAM,wBAAwB,CAAC;AAEhD,OAAO,gBAAgB,MAAM,iCAAiC,CAAC;AAC/D,OAAO,MAAM,MAAM,wBAAwB,CAAC;AAE5C,MAAM,CAAC,OAAO,OAAO,aAA2B,SAAQ,MAAM;
|
|
1
|
+
{"version":3,"file":"XernerxClient.js","sourceRoot":"","sources":["../../src/client/XernerxClient.ts"],"names":[],"mappings":"AAAA,cAAc;AAEd,OAAO,EAAE,MAAM,EAAiB,UAAU,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,cAAc,MAAM,+BAA+B,CAAC;AAC3D,OAAO,YAAY,M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AAC;QAEF,IAAI,CAAC,MAAM,GAAG,IAAI,UAAU,EAAE,CAAC;QAE/B,IAAI,CAAC,UAAU,GAAG,IAAI,UAAU,EAAE,CAAC;QAEnC,IAAI,CAAC,OAAO,GAAG;YACd,OAAO,EAAE,EAAE;YACX,cAAc,EAAE,IAAI,cAAc,CAAC,IAAI,CAAC;YACxC,YAAY,EAAE,IAAI,YAAY,CAAC,IAAI,CAAC;YACpC,gBAAgB,EAAE,IAAI,gBAAgB,CAAC,IAAI,CAAC;YAC5C,cAAc,EAAE,IAAI,cAAc,CAAC,IAAI,CAAC;YACxC,gBAAgB,EAAE,IAAI,gBAAgB,CAAC,IAAI,CAAC;SACnC,CAAC;QAEX,IAAI,CAAC,IAAI,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC;QAEjC,IAAI,CAAC,KAAK,GAAG;YACZ,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI;YAClC,SAAS,EAAE,CAAC;YACZ,OAAO,EAAE,CAAC;YACV,UAAU,EAAE,CAAC;SACb,CAAC;QAEF,IAAI,CAAC,KAAK,GAAG;YACZ,QAAQ,EAAE,IAAI,UAAU,EAAE;YAC1B,SAAS,EAAE,IAAI,UAAU,EAAE;SAC3B,CAAC;QAEF,OAAO,IAAI,CAAC;IACb,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,KAAa;QACjC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAEhC,MAAM,CAAC,IAAI,CAAC,CAAC;QAEb,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,CAAC;QAE7B,OAAO,KAAK,CAAC;IACd,CAAC;CACD","sourcesContent":["/** @format */\n\nimport { Client, ClientOptions, Collection } from 'discord.js';\nimport { z } from 'zod';\n\nimport CommandHandler from '../handlers/CommandHandler.js';\nimport EventHandler from '../handlers/EventHandler.js';\nimport InhibitorHandler from '../handlers/InhibitorHandler.js';\nimport WebhookHandler from '../handlers/WebhookHandler.js';\nimport XernerxLog from '../tools/XernerxLog.js';\nimport { XernerxOptions, ModuleOptions, XernerxCommands, XernerxCache } from '../types/interfaces.js';\nimport ClientUtil from '../utils/ClientUtil.js';\nimport { XernerxInhibitor, XernerxEvent } from '../main.js';\nimport ExtensionHandler from '../handlers/ExtensionHandler.js';\nimport deploy from '../functions/deploy.js';\n\nexport default class XernerxClient<T = unknown> extends Client {\n\tpublic declare readonly settings;\n\tpublic declare readonly config;\n\tpublic declare readonly commands: XernerxCommands;\n\tpublic declare readonly events: Collection<string, XernerxEvent>;\n\tpublic declare readonly inhibitors: Collection<string, XernerxInhibitor>;\n\tpublic declare readonly modules: ModuleOptions;\n\tpublic declare readonly util: ClientUtil;\n\tpublic declare readonly stats: Record<string, number>;\n\tpublic declare readonly cache: XernerxCache;\n\n\tpublic constructor(discordOptions: ClientOptions, xernerxOptions: XernerxOptions, config?: T) {\n\t\tsuper(discordOptions);\n\n\t\tthis.settings = z\n\t\t\t.object({\n\t\t\t\tlocal: z.string(),\n\t\t\t\tglobal: z.boolean().default(false).optional(),\n\t\t\t\townerId: z.string().or(z.array(z.string())).default([]),\n\t\t\t\tpermissions: z\n\t\t\t\t\t.object({\n\t\t\t\t\t\tclient: z.array(z.string()).default([]),\n\t\t\t\t\t\tuser: z.array(z.string()).default([]),\n\t\t\t\t\t\tdm: z.boolean().default(false),\n\t\t\t\t\t})\n\t\t\t\t\t.optional(),\n\t\t\t\tignore: z\n\t\t\t\t\t.object({\n\t\t\t\t\t\towner: z.boolean().default(false),\n\t\t\t\t\t\tusers: z.array(z.string()).default([]),\n\t\t\t\t\t\tchannels: z.array(z.string()).default([]),\n\t\t\t\t\t\tguilds: z.array(z.string()).default([]),\n\t\t\t\t\t})\n\t\t\t\t\t.optional(),\n\t\t\t\tlog: z\n\t\t\t\t\t.object({\n\t\t\t\t\t\tready: z.boolean().default(false),\n\t\t\t\t\t\tinfo: z.boolean().default(false),\n\t\t\t\t\t\terror: z.boolean().default(false),\n\t\t\t\t\t\ttable: z.array(z.string()).or(z.null()).default(null),\n\t\t\t\t\t})\n\t\t\t\t\t.optional(),\n\t\t\t\tcooldown: z\n\t\t\t\t\t.object({\n\t\t\t\t\t\tcommand: z.number().default(0),\n\t\t\t\t\t\tcache: z.number().default(0),\n\t\t\t\t\t})\n\t\t\t\t\t.optional(),\n\t\t\t})\n\t\t\t.parse(xernerxOptions);\n\n\t\tthis.config = config || null;\n\n\t\tthis.commands = {\n\t\t\tmessage: new Collection(),\n\t\t\tslash: new Collection(),\n\t\t\tcontext: new Collection(),\n\t\t};\n\n\t\tthis.events = new Collection();\n\n\t\tthis.inhibitors = new Collection();\n\n\t\tthis.modules = {\n\t\t\toptions: {},\n\t\t\tcommandHandler: new CommandHandler(this),\n\t\t\teventHandler: new EventHandler(this),\n\t\t\tinhibitorHandler: new InhibitorHandler(this),\n\t\t\twebhookHandler: new WebhookHandler(this),\n\t\t\textensionHandler: new ExtensionHandler(this),\n\t\t} as const;\n\n\t\tthis.util = new ClientUtil(this);\n\n\t\tthis.stats = {\n\t\t\tguildCount: this.guilds.cache.size,\n\t\t\tuserCount: 0,\n\t\t\tshardId: 0,\n\t\t\tshardCount: 1,\n\t\t};\n\n\t\tthis.cache = {\n\t\t\tmessages: new Collection(),\n\t\t\tcooldowns: new Collection(),\n\t\t};\n\n\t\treturn this;\n\t}\n\n\tpublic async connect(token: string) {\n\t\tconst login = this.login(token);\n\n\t\tdeploy(this);\n\n\t\tnew XernerxLog(this).ready();\n\n\t\treturn login;\n\t}\n}\n"]}
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
+
/** @format */
|
|
1
2
|
import { ShardingManager, ShardingManagerOptions, ClientUser } from 'discord.js';
|
|
2
3
|
interface XernerxOptions {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
log?: {
|
|
5
|
+
info?: boolean;
|
|
6
|
+
};
|
|
6
7
|
}
|
|
7
8
|
export default class XernerxShardClient extends ShardingManager {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
readonly stats: {
|
|
10
|
+
guildCount: number;
|
|
11
|
+
userCount: number;
|
|
12
|
+
shardCount: number;
|
|
13
|
+
};
|
|
14
|
+
user: ClientUser | null;
|
|
15
|
+
constructor(file: string, discordOptions: ShardingManagerOptions, xernerxOptions?: XernerxOptions);
|
|
15
16
|
}
|
|
16
17
|
export {};
|
|
17
18
|
//# sourceMappingURL=XernerxShardClient.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"XernerxShardClient.d.ts","sourceRoot":"","sources":["../../src/client/XernerxShardClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAS,UAAU,EAAE,MAAM,YAAY,CAAC;AAIxF,UAAU,cAAc;
|
|
1
|
+
{"version":3,"file":"XernerxShardClient.d.ts","sourceRoot":"","sources":["../../src/client/XernerxShardClient.ts"],"names":[],"mappings":"AAAA,cAAc;AAEd,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAS,UAAU,EAAE,MAAM,YAAY,CAAC;AAIxF,UAAU,cAAc;IACvB,GAAG,CAAC,EAAE;QACL,IAAI,CAAC,EAAE,OAAO,CAAC;KACf,CAAC;CACF;AAED,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,eAAe;IAC9D,SAAwB,KAAK;;;;MAAC;IACf,IAAI,EAAE,UAAU,GAAG,IAAI,CAAC;gBAE3B,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE,sBAAsB,EAAE,cAAc,CAAC,EAAE,cAAc;CA6DjG"}
|
|
@@ -1,54 +1,55 @@
|
|
|
1
|
+
/** @format */
|
|
1
2
|
import { ShardingManager } from 'discord.js';
|
|
2
3
|
import XernerxLog from '../tools/XernerxLog.js';
|
|
3
4
|
import { Style } from 'dumfunctions';
|
|
4
5
|
export default class XernerxShardClient extends ShardingManager {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
6
|
+
constructor(file, discordOptions, xernerxOptions) {
|
|
7
|
+
super(file, discordOptions);
|
|
8
|
+
this.stats = { guildCount: 0, userCount: 0, shardCount: 0 };
|
|
9
|
+
this.user = null;
|
|
10
|
+
this.on('shardCreate', async (shard) => {
|
|
11
|
+
shard
|
|
12
|
+
.on('ready', async () => {
|
|
13
|
+
const guilds = await shard.fetchClientValue('guilds.cache');
|
|
14
|
+
const guildCount = guilds.length;
|
|
15
|
+
const userCount = guilds.map((guild) => guild.memberCount).length ? guilds.map((guild) => guild.memberCount).reduce((a, b) => (a += b)) : 0;
|
|
16
|
+
this.user = await shard.fetchClientValue('user');
|
|
17
|
+
this.stats.guildCount += Number(guildCount);
|
|
18
|
+
this.stats.userCount += Number(userCount);
|
|
19
|
+
this.stats.shardCount++;
|
|
20
|
+
await new XernerxLog({ settings: xernerxOptions }).info(
|
|
21
|
+
`Launched shard ${Style.log(String(shard.id), { color: Style.TextColor.Cyan })} for ${Style.log(this.user?.tag, { color: Style.TextColor.Blue })}!`
|
|
22
|
+
);
|
|
23
|
+
})
|
|
24
|
+
.on('error', (error) => {
|
|
25
|
+
new XernerxLog({ settings: xernerxOptions }).info(
|
|
26
|
+
`An error occurred in ${Style.log(String(shard.id), { color: Style.TextColor.Cyan })} for ${Style.log(String(this.user?.tag), { color: Style.TextColor.Blue })}! ${error}`
|
|
27
|
+
);
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
const spawn = this.spawn();
|
|
31
|
+
spawn.then(async (shards) => {
|
|
32
|
+
const collector = setInterval(() => {
|
|
33
|
+
const index = shards.size - 1;
|
|
34
|
+
if (shards.get(index)?.ready) {
|
|
35
|
+
new XernerxLog({ settings: xernerxOptions }).info(
|
|
36
|
+
`All Shards launched for ${Style.log(String(this.user?.tag), {
|
|
37
|
+
color: Style.TextColor.Blue,
|
|
38
|
+
})} with a total of ${Style.log(String(this.stats.shardCount), { color: Style.TextColor.Cyan })} shard${this.stats.shardCount > 1 ? 's' : ''}, watching ${Style.log(
|
|
39
|
+
String(this.stats.guildCount),
|
|
40
|
+
{
|
|
41
|
+
color: Style.TextColor.Cyan,
|
|
42
|
+
}
|
|
43
|
+
)} guild${this.stats.guildCount > 1 ? 's' : ''}, and ${Style.log(String(this.stats.userCount), { color: Style.TextColor.Cyan })} user${this.stats.userCount > 1 ? 's' : ''}!`
|
|
44
|
+
);
|
|
45
|
+
clearInterval(collector);
|
|
46
|
+
}
|
|
47
|
+
}, 1000);
|
|
48
|
+
});
|
|
49
|
+
return {
|
|
50
|
+
shards: spawn,
|
|
51
|
+
stats: this.stats,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
53
54
|
}
|
|
54
55
|
//# sourceMappingURL=XernerxShardClient.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"XernerxShardClient.js","sourceRoot":"","sources":["../../src/client/XernerxShardClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAA6C,MAAM,YAAY,CAAC;AACxF,OAAO,UAAU,MAAM,wBAAwB,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,CAC7K,CAAC;oBAEF,aAAa,CAAC,SAAS,CAAC,CAAC;iBACzB;YACF,CAAC,EAAE,IAAI,CAAC,CAAC;QACV,CAAC,CAAC,CAAC;QAEH,OAAO;YACN,MAAM,EAAE,KAAK;YACb,KAAK,EAAE,IAAI,CAAC,KAAK;SACR,CAAC;IACZ,CAAC;CACD","sourcesContent":["/** @format */\n\nimport { ShardingManager, ShardingManagerOptions, Guild, ClientUser } from 'discord.js';\nimport XernerxLog from '../tools/XernerxLog.js';\nimport { Style } from 'dumfunctions';\n\ninterface XernerxOptions {\n\tlog?: {\n\t\tinfo?: boolean;\n\t};\n}\n\nexport default class XernerxShardClient extends ShardingManager {\n\tpublic declare readonly stats;\n\tpublic declare user: ClientUser | null;\n\n\tconstructor(file: string, discordOptions: ShardingManagerOptions, xernerxOptions?: XernerxOptions) {\n\t\tsuper(file, discordOptions);\n\n\t\tthis.stats = { guildCount: 0, userCount: 0, shardCount: 0 };\n\n\t\tthis.user = null;\n\n\t\tthis.on('shardCreate', async (shard) => {\n\t\t\tshard\n\t\t\t\t.on('ready', async () => {\n\t\t\t\t\tconst guilds = (await shard.fetchClientValue('guilds.cache')) as Array<Guild>;\n\t\t\t\t\tconst guildCount = guilds.length;\n\t\t\t\t\tconst userCount = guilds.map((guild) => guild.memberCount).length ? guilds.map((guild) => guild.memberCount).reduce((a, b) => (a += b)) : 0;\n\n\t\t\t\t\tthis.user = (await shard.fetchClientValue('user')) as ClientUser;\n\n\t\t\t\t\tthis.stats.guildCount += Number(guildCount);\n\n\t\t\t\t\tthis.stats.userCount += Number(userCount);\n\n\t\t\t\t\tthis.stats.shardCount++;\n\n\t\t\t\t\tawait new XernerxLog({ settings: xernerxOptions } as never).info(\n\t\t\t\t\t\t`Launched shard ${Style.log(String(shard.id), { color: Style.TextColor.Cyan })} for ${Style.log(this.user?.tag, { color: Style.TextColor.Blue })}!`\n\t\t\t\t\t);\n\t\t\t\t})\n\t\t\t\t.on('error', (error) => {\n\t\t\t\t\tnew XernerxLog({ settings: xernerxOptions } as never).info(\n\t\t\t\t\t\t`An error occurred in ${Style.log(String(shard.id), { color: Style.TextColor.Cyan })} for ${Style.log(String(this.user?.tag), { color: Style.TextColor.Blue })}! ${error}`\n\t\t\t\t\t);\n\t\t\t\t});\n\t\t});\n\n\t\tconst spawn = this.spawn();\n\n\t\tspawn.then(async (shards) => {\n\t\t\tconst collector = setInterval(() => {\n\t\t\t\tconst index = shards.size - 1;\n\n\t\t\t\tif (shards.get(index)?.ready) {\n\t\t\t\t\tnew XernerxLog({ settings: xernerxOptions } as never).info(\n\t\t\t\t\t\t`All Shards launched for ${Style.log(String(this.user?.tag), {\n\t\t\t\t\t\t\tcolor: Style.TextColor.Blue,\n\t\t\t\t\t\t})} with a total of ${Style.log(String(this.stats.shardCount), { color: Style.TextColor.Cyan })} shard${this.stats.shardCount > 1 ? 's' : ''}, watching ${Style.log(\n\t\t\t\t\t\t\tString(this.stats.guildCount),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tcolor: Style.TextColor.Cyan,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t)} guild${this.stats.guildCount > 1 ? 's' : ''}, and ${Style.log(String(this.stats.userCount), { color: Style.TextColor.Cyan })} user${this.stats.userCount > 1 ? 's' : ''}!`\n\t\t\t\t\t);\n\n\t\t\t\t\tclearInterval(collector);\n\t\t\t\t}\n\t\t\t}, 1000);\n\t\t});\n\n\t\treturn {\n\t\t\tshards: spawn,\n\t\t\tstats: this.stats,\n\t\t} as never;\n\t}\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/functions/deploy.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/functions/deploy.ts"],"names":[],"mappings":"AAAA,cAAc;AAMd,OAAO,aAAa,MAAM,4BAA4B,CAAC;AAOvD,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,MAAM,EAAE,aAAa,QA6BnD"}
|
package/dist/functions/deploy.js
CHANGED
|
@@ -1,40 +1,41 @@
|
|
|
1
|
+
/** @format */
|
|
1
2
|
import { GatewayVersion, REST, Routes } from 'discord.js';
|
|
2
3
|
import XernerxLog from '../tools/XernerxLog.js';
|
|
3
4
|
import XernerxError from '../tools/XernerxError.js';
|
|
4
5
|
import { Style } from 'dumfunctions';
|
|
5
6
|
const commands = [];
|
|
6
7
|
export default function deploy(client) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
8
|
+
client.prependOnceListener('ready', (client) => {
|
|
9
|
+
if (client.commands.slash.size) client.commands.slash.map((command) => commands.push(command.data.toJSON()));
|
|
10
|
+
if (client.commands.context.size) client.commands.context.map((command) => commands.push(command.data.toJSON()));
|
|
11
|
+
if (commands.length <= 0) return;
|
|
12
|
+
try {
|
|
13
|
+
if (client.settings.global) {
|
|
14
|
+
put(client, client.settings.global, commands);
|
|
15
|
+
put(client, !client.settings.global, []);
|
|
16
|
+
} else {
|
|
17
|
+
put(client, !client.settings.global, commands);
|
|
18
|
+
put(client, client.settings.global, []);
|
|
19
|
+
}
|
|
20
|
+
} catch (error) {
|
|
21
|
+
new XernerxLog(client).error(`An error occurred while deploying the interaction commands!`, error);
|
|
22
|
+
} finally {
|
|
23
|
+
new XernerxLog(client).info(
|
|
24
|
+
`Deployed ${Style.log(String([client.commands.message.size, client.commands.slash.size, client.commands.context.size].reduce((a, b) => (a += b))), {
|
|
25
|
+
color: Style.TextColor.Cyan,
|
|
26
|
+
})} Commands ${
|
|
27
|
+
client.settings.global
|
|
28
|
+
? Style.log('globally', { color: Style.TextColor.Green })
|
|
29
|
+
: `${Style.log('locally', { color: Style.TextColor.Red })} in ${Style.log(client.guilds.cache.get(client.settings.local).name, { color: Style.TextColor.Blue })}`
|
|
30
|
+
}.`
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
33
34
|
}
|
|
34
35
|
function put(client, global, body) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
const rest = new REST({ version: GatewayVersion }).setToken(client.token);
|
|
37
|
+
if (!global && !client.settings?.local) throw new XernerxError(`No guild ID provided as local guild!`);
|
|
38
|
+
if (!global && client.settings?.local) rest.put(Routes.applicationGuildCommands(client.user?.id, client.settings.local), { body });
|
|
39
|
+
else rest.put(Routes.applicationCommands(client.user?.id), { body });
|
|
39
40
|
}
|
|
40
41
|
//# sourceMappingURL=deploy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.js","sourceRoot":"","sources":["../../src/functions/deploy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAK1D,OAAO,UAAU,MAAM,wBAAwB,CAAC;AAChD,OAAO,YAAY,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAErC,MAAM,QAAQ,GAA6D,EAAE,CAAC;AAE9E,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,MAAqB;
|
|
1
|
+
{"version":3,"file":"deploy.js","sourceRoot":"","sources":["../../src/functions/deploy.ts"],"names":[],"mappings":"AAAA,cAAc;AAEd,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAK1D,OAAO,UAAU,MAAM,wBAAwB,CAAC;AAChD,OAAO,YAAY,MAAM,0BAA0B,CAAC;AACpD,O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AAE,KAAK;QAAE,MAAM,IAAI,YAAY,CAAC,sCAAsC,CAAC,CAAC;IAEvG,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,QAAQ,EAAE,KAAK;QAAE,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,wBAAwB,CAAC,MAAM,CAAC,IAAI,EAAE,EAAY,EAAE,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;;QACxI,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,mBAAmB,CAAC,MAAM,CAAC,IAAI,EAAE,EAAY,CAAC,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;AAChF,CAAC","sourcesContent":["/** @format */\n\nimport { GatewayVersion, REST, Routes } from 'discord.js';\n\nimport XernerxContextCommand from '../build/XernerxContextCommand.js';\nimport XernerxSlashCommand from '../build/XernerxSlashCommand.js';\nimport XernerxClient from '../client/XernerxClient.js';\nimport XernerxLog from '../tools/XernerxLog.js';\nimport XernerxError from '../tools/XernerxError.js';\nimport { Style } from 'dumfunctions';\n\nconst commands: Array<XernerxSlashCommand | XernerxContextCommand | any> = [];\n\nexport default function deploy(client: XernerxClient) {\n\tclient.prependOnceListener('ready', (client) => {\n\t\tif (client.commands.slash.size) client.commands.slash.map((command: XernerxSlashCommand | XernerxContextCommand) => commands.push(command.data.toJSON()));\n\t\tif (client.commands.context.size) client.commands.context.map((command: XernerxSlashCommand | XernerxContextCommand) => commands.push(command.data.toJSON()));\n\n\t\tif (commands.length <= 0) return;\n\n\t\ttry {\n\t\t\tif (client.settings.global) {\n\t\t\t\tput(client, client.settings.global, commands);\n\t\t\t\tput(client, !client.settings.global, []);\n\t\t\t} else {\n\t\t\t\tput(client, !client.settings.global, commands);\n\t\t\t\tput(client, client.settings.global, []);\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tnew XernerxLog(client).error(`An error occurred while deploying the interaction commands!`, error);\n\t\t} finally {\n\t\t\tnew XernerxLog(client).info(\n\t\t\t\t`Deployed ${Style.log(String([client.commands.message.size, client.commands.slash.size, client.commands.context.size].reduce((a, b) => (a += b))), {\n\t\t\t\t\tcolor: Style.TextColor.Cyan,\n\t\t\t\t})} Commands ${\n\t\t\t\t\tclient.settings.global\n\t\t\t\t\t\t? Style.log('globally', { color: Style.TextColor.Green })\n\t\t\t\t\t\t: `${Style.log('locally', { color: Style.TextColor.Red })} in ${Style.log(client.guilds.cache.get(client.settings.local).name, { color: Style.TextColor.Blue })}`\n\t\t\t\t}.`\n\t\t\t);\n\t\t}\n\t});\n}\n\nfunction put(client: XernerxClient, global: boolean, body: Array<object>) {\n\tconst rest = new REST({ version: GatewayVersion }).setToken(client.token as string);\n\n\tif (!global && !client.settings?.local) throw new XernerxError(`No guild ID provided as local guild!`);\n\n\tif (!global && client.settings?.local) rest.put(Routes.applicationGuildCommands(client.user?.id as string, client.settings.local), { body });\n\telse rest.put(Routes.applicationCommands(client.user?.id as string), { body });\n}\n"]}
|
package/dist/functions/load.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load.d.ts","sourceRoot":"","sources":["../../src/functions/load.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"load.d.ts","sourceRoot":"","sources":["../../src/functions/load.ts"],"names":[],"mappings":"AAAA,cAAc;AAOd,OAAO,aAAa,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAG7C,wBAA8B,IAAI,CAAC,MAAM,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,gBAgBrF"}
|