xernerx 4.4.16 → 4.4.18
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/ContextCommandBuilder.d.ts +23 -31
- package/dist/build/ContextCommandBuilder.js +39 -39
- package/dist/build/EventBuilder.d.ts +2 -2
- package/dist/build/EventBuilder.d.ts.map +1 -1
- package/dist/build/EventBuilder.js +2 -2
- package/dist/build/EventBuilder.js.map +1 -1
- package/dist/build/InhibitorBuilder.d.ts +2 -11
- package/dist/build/InhibitorBuilder.js +2 -2
- package/dist/build/MessageCommandBuilder.d.ts +20 -26
- package/dist/build/MessageCommandBuilder.js +34 -34
- package/dist/build/SlashCommandBuilder.d.ts +25 -39
- package/dist/build/SlashCommandBuilder.js +48 -48
- package/dist/client/XernerxClient.d.ts +22 -30
- package/dist/client/XernerxClient.d.ts.map +1 -1
- package/dist/client/XernerxClient.js +35 -33
- package/dist/client/XernerxClient.js.map +1 -1
- package/dist/client/XernerxShardClient.d.ts +1 -1
- package/dist/client/XernerxShardClient.d.ts.map +1 -1
- package/dist/client/XernerxShardClient.js +17 -16
- package/dist/client/XernerxShardClient.js.map +1 -1
- package/dist/functions/delay.d.ts +1 -1
- package/dist/functions/delay.js +1 -1
- package/dist/functions/deploy.d.ts +2 -2
- package/dist/functions/deploy.d.ts.map +1 -1
- package/dist/functions/deploy.js +24 -18
- package/dist/functions/deploy.js.map +1 -1
- package/dist/functions/isOwner.d.ts +1 -1
- package/dist/functions/isOwner.js +1 -1
- package/dist/functions/isVoter.d.ts +1 -1
- package/dist/functions/isVoter.js +1 -1
- package/dist/functions/load.d.ts +1 -1
- package/dist/functions/load.js +3 -2
- package/dist/functions/reload.d.ts +1 -1
- package/dist/functions/reload.js +12 -9
- package/dist/functions/sendWebhook.d.ts +1 -1
- package/dist/functions/sendWebhook.js +3 -2
- package/dist/functions/setPresence.d.ts +2 -2
- package/dist/functions/setPresence.js +11 -12
- package/dist/functions/xernerxUser.d.ts +1 -1
- package/dist/functions/xernerxUser.js +1 -1
- package/dist/handlers/CommandHandler.d.ts +1 -1
- package/dist/handlers/CommandHandler.d.ts.map +1 -1
- package/dist/handlers/CommandHandler.js +109 -89
- package/dist/handlers/CommandHandler.js.map +1 -1
- package/dist/handlers/EventHandler.d.ts +1 -1
- package/dist/handlers/EventHandler.js +3 -3
- package/dist/handlers/ExtensionHandler.d.ts +1 -1
- package/dist/handlers/ExtensionHandler.js +5 -3
- package/dist/handlers/Handler.d.ts +1 -1
- package/dist/handlers/Handler.js +16 -6
- package/dist/handlers/InhibitorHandler.d.ts +1 -1
- package/dist/handlers/InhibitorHandler.js +3 -3
- package/dist/handlers/WebhookHandler.d.ts +4 -2
- package/dist/handlers/WebhookHandler.js +6 -9
- package/dist/main.d.ts +22 -29
- package/dist/main.js +22 -29
- package/dist/models/Arguments.d.ts +2 -5
- package/dist/models/Arguments.js +63 -48
- package/dist/tools/XernerxError.d.ts +1 -1
- package/dist/tools/XernerxError.js +1 -1
- package/dist/tools/XernerxLog.d.ts +1 -1
- package/dist/tools/XernerxLog.js +2 -7
- package/dist/types/extenders.d.ts +9 -5
- package/dist/types/extenders.js +1 -1
- package/dist/types/interfaces.d.ts +9 -12
- package/dist/types/interfaces.d.ts.map +1 -1
- package/dist/types/interfaces.js +1 -1
- package/dist/types/interfaces.js.map +1 -1
- package/dist/types/types.d.ts +7 -179
- package/dist/types/types.js +1 -1
- package/dist/utils/ClientUtil.d.ts +4 -4
- package/dist/utils/ClientUtil.js +14 -8
- package/dist/utils/InteractionUtil.d.ts +2 -2
- package/dist/utils/InteractionUtil.js +1 -1
- package/dist/utils/MessageUtil.d.ts +2 -2
- package/dist/utils/MessageUtil.js +9 -5
- package/dist/utils/Util.d.ts +1 -1
- package/dist/utils/Util.js +1 -1
- package/dist/validators/commandValidation.d.ts +2 -5
- package/dist/validators/commandValidation.js +29 -19
- package/dist/validators/inhibitorValidations.d.ts +3 -19
- package/dist/validators/inhibitorValidations.js +2 -2
- package/package.json +1 -1
|
@@ -7,44 +7,45 @@ import WebhookHandler from '../handlers/WebhookHandler.js';
|
|
|
7
7
|
import XernerxLog from '../tools/XernerxLog.js';
|
|
8
8
|
import ClientUtil from '../utils/ClientUtil.js';
|
|
9
9
|
import ExtensionHandler from '../handlers/ExtensionHandler.js';
|
|
10
|
+
import deploy from '../functions/deploy.js';
|
|
10
11
|
export default class XernerxClient extends Client {
|
|
11
12
|
constructor(discordOptions, xernerxOptions, config) {
|
|
12
13
|
super(discordOptions);
|
|
13
14
|
this.settings = z
|
|
14
15
|
.object({
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
})
|
|
24
|
-
.optional(),
|
|
25
|
-
ignore: z
|
|
26
|
-
.object({
|
|
27
|
-
owner: z.boolean().default(false),
|
|
28
|
-
users: z.array(z.string()).default([]),
|
|
29
|
-
channels: z.array(z.string()).default([]),
|
|
30
|
-
guilds: z.array(z.string()).default([]),
|
|
31
|
-
})
|
|
32
|
-
.optional(),
|
|
33
|
-
log: z
|
|
34
|
-
.object({
|
|
35
|
-
ready: z.boolean().default(false),
|
|
36
|
-
info: z.boolean().default(false),
|
|
37
|
-
error: z.boolean().default(false),
|
|
38
|
-
table: z.array(z.string()).or(z.null()).default(null),
|
|
39
|
-
})
|
|
40
|
-
.optional(),
|
|
41
|
-
cooldown: z
|
|
42
|
-
.object({
|
|
43
|
-
command: z.number().default(0),
|
|
44
|
-
cache: z.number().default(0),
|
|
45
|
-
})
|
|
46
|
-
.optional(),
|
|
16
|
+
local: z.string().or(z.undefined()).optional(),
|
|
17
|
+
global: z.boolean().default(false).optional(),
|
|
18
|
+
ownerId: z.string().or(z.array(z.string())).default([]),
|
|
19
|
+
permissions: z
|
|
20
|
+
.object({
|
|
21
|
+
client: z.array(z.string()).default([]),
|
|
22
|
+
user: z.array(z.string()).default([]),
|
|
23
|
+
dm: z.boolean().default(false),
|
|
47
24
|
})
|
|
25
|
+
.optional(),
|
|
26
|
+
ignore: z
|
|
27
|
+
.object({
|
|
28
|
+
owner: z.boolean().default(false),
|
|
29
|
+
users: z.array(z.string()).default([]),
|
|
30
|
+
channels: z.array(z.string()).default([]),
|
|
31
|
+
guilds: z.array(z.string()).default([]),
|
|
32
|
+
})
|
|
33
|
+
.optional(),
|
|
34
|
+
log: z
|
|
35
|
+
.object({
|
|
36
|
+
ready: z.boolean().default(false),
|
|
37
|
+
info: z.boolean().default(false),
|
|
38
|
+
error: z.boolean().default(false),
|
|
39
|
+
table: z.array(z.string()).or(z.null()).default(null),
|
|
40
|
+
})
|
|
41
|
+
.optional(),
|
|
42
|
+
cooldown: z
|
|
43
|
+
.object({
|
|
44
|
+
command: z.number().default(0),
|
|
45
|
+
cache: z.number().default(0),
|
|
46
|
+
})
|
|
47
|
+
.optional(),
|
|
48
|
+
})
|
|
48
49
|
.parse(xernerxOptions);
|
|
49
50
|
this.config = config || null;
|
|
50
51
|
this.commands = {
|
|
@@ -77,7 +78,8 @@ export default class XernerxClient extends Client {
|
|
|
77
78
|
}
|
|
78
79
|
connect(token) {
|
|
79
80
|
this.login(token);
|
|
81
|
+
deploy(this);
|
|
80
82
|
new XernerxLog(this).ready();
|
|
81
83
|
}
|
|
82
84
|
}
|
|
83
|
-
//# sourceMappingURL=XernerxClient.js.map
|
|
85
|
+
//# 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,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,IAAI,UAAU,EAAE;SAC9B,CAAC;QAEF,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,OAAO,CAAC,KAAa;QACxB,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAElB,MAAM,CAAC,IAAI,CAAC,CAAC;QAEb,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,CAAC;IACjC,CAAC;CACJ","sourcesContent":["import { 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 { InhibitorBuilder, EventBuilder } from '../main.js';\nimport ExtensionHandler from '../handlers/ExtensionHandler.js';\nimport deploy from '../functions/deploy.js';\n\nexport default class XernerxClient extends Client {\n public declare readonly settings;\n public declare readonly config;\n public declare readonly commands: XernerxCommands;\n public declare readonly events: Collection<string, EventBuilder>;\n public declare readonly inhibitors: Collection<string, InhibitorBuilder>;\n public declare readonly modules: ModuleOptions;\n public declare readonly util: ClientUtil;\n public declare readonly stats: Record<string, number>;\n public declare readonly cache: XernerxCache;\n\n public constructor(discordOptions: ClientOptions, xernerxOptions: XernerxOptions, config?: Record<string, unknown>) {\n super(discordOptions);\n\n this.settings = z\n .object({\n local: z.string().or(z.undefined()).optional(),\n global: z.boolean().default(false).optional(),\n ownerId: z.string().or(z.array(z.string())).default([]),\n permissions: z\n .object({\n client: z.array(z.string()).default([]),\n user: z.array(z.string()).default([]),\n dm: z.boolean().default(false),\n })\n .optional(),\n ignore: z\n .object({\n owner: z.boolean().default(false),\n users: z.array(z.string()).default([]),\n channels: z.array(z.string()).default([]),\n guilds: z.array(z.string()).default([]),\n })\n .optional(),\n log: z\n .object({\n ready: z.boolean().default(false),\n info: z.boolean().default(false),\n error: z.boolean().default(false),\n table: z.array(z.string()).or(z.null()).default(null),\n })\n .optional(),\n cooldown: z\n .object({\n command: z.number().default(0),\n cache: z.number().default(0),\n })\n .optional(),\n })\n .parse(xernerxOptions);\n\n this.config = config || null;\n\n this.commands = {\n message: new Collection(),\n slash: new Collection(),\n context: new Collection(),\n };\n\n this.events = new Collection();\n\n this.inhibitors = new Collection();\n\n this.modules = {\n options: {},\n commandHandler: new CommandHandler(this),\n eventHandler: new EventHandler(this),\n inhibitorHandler: new InhibitorHandler(this),\n webhookHandler: new WebhookHandler(this),\n extensionHandler: new ExtensionHandler(this),\n } as const;\n\n this.util = new ClientUtil(this);\n\n this.stats = {\n guildCount: this.guilds.cache.size,\n userCount: 0,\n shardId: 0,\n shardCount: 1,\n };\n\n this.cache = {\n messages: new Collection(),\n cooldowns: new Collection(),\n };\n\n return this;\n }\n\n public connect(token: string) {\n this.login(token);\n\n deploy(this);\n\n new XernerxLog(this).ready();\n }\n}\n"]}
|
|
@@ -14,4 +14,4 @@ export default class XernerxShardClient extends ShardingManager {
|
|
|
14
14
|
constructor(file: string, discordOptions: ShardingManagerOptions, xernerxOptions?: XernerxOptions);
|
|
15
15
|
}
|
|
16
16
|
export {};
|
|
17
|
-
//# sourceMappingURL=XernerxShardClient.d.ts.map
|
|
17
|
+
//# 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;AAGxF,UAAU,cAAc;IACpB,GAAG,CAAC,EAAE;QACF,IAAI,CAAC,EAAE,OAAO,CAAC;KAClB,CAAC;CACL;AAED,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,eAAe;IAC3D,SAAwB,KAAK;;;;MAAC;IACf,IAAI,EAAE,UAAU,GAAG,IAAI,CAAC;gBAE3B,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE,sBAAsB,EAAE,cAAc,CAAC,EAAE,cAAc;
|
|
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;AAGxF,UAAU,cAAc;IACpB,GAAG,CAAC,EAAE;QACF,IAAI,CAAC,EAAE,OAAO,CAAC;KAClB,CAAC;CACL;AAED,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,eAAe;IAC3D,SAAwB,KAAK;;;;MAAC;IACf,IAAI,EAAE,UAAU,GAAG,IAAI,CAAC;gBAE3B,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE,sBAAsB,EAAE,cAAc,CAAC,EAAE,cAAc;CAkDpG"}
|
|
@@ -8,32 +8,33 @@ export default class XernerxShardClient extends ShardingManager {
|
|
|
8
8
|
this.on('shardCreate', async (shard) => {
|
|
9
9
|
shard
|
|
10
10
|
.on('ready', async () => {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
11
|
+
const guilds = (await shard.fetchClientValue('guilds.cache'));
|
|
12
|
+
const guildCount = guilds.length;
|
|
13
|
+
const userCount = guilds.map((guild) => guild.memberCount).length ? guilds.map((guild) => guild.memberCount).reduce((a, b) => (a += b)) : 0;
|
|
14
|
+
this.stats.guildCount += Number(guildCount);
|
|
15
|
+
this.stats.userCount += Number(userCount);
|
|
16
|
+
this.stats.shardCount++;
|
|
17
|
+
this.user = (await shard.fetchClientValue('user'));
|
|
18
|
+
await new XernerxLog({ settings: xernerxOptions }).info(`Launched shard ${shard.id} for ${this.user?.tag}!`);
|
|
19
|
+
})
|
|
20
20
|
.on('error', (error) => {
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
new XernerxLog({ settings: xernerxOptions }).info(`An error occurred in ${shard.id} for ${this.user?.tag}! ${error}`);
|
|
22
|
+
});
|
|
23
23
|
});
|
|
24
24
|
const spawn = this.spawn();
|
|
25
25
|
spawn.then(async (shards) => {
|
|
26
26
|
const collector = setInterval(() => {
|
|
27
27
|
const index = shards.size - 1;
|
|
28
28
|
if (shards.get(index)?.ready) {
|
|
29
|
-
new XernerxLog({ settings: xernerxOptions }).info(
|
|
30
|
-
`Launched all ${this.stats.shardCount} shards for ${this.user?.tag}, watching ${this.stats.guildCount} guilds, and ${this.stats.userCount} users!`
|
|
31
|
-
);
|
|
29
|
+
new XernerxLog({ settings: xernerxOptions }).info(`Launched all ${this.stats.shardCount} shards for ${this.user?.tag}, watching ${this.stats.guildCount} guilds, and ${this.stats.userCount} users!`);
|
|
32
30
|
clearInterval(collector);
|
|
33
31
|
}
|
|
34
32
|
}, 1000);
|
|
35
33
|
});
|
|
36
|
-
return
|
|
34
|
+
return {
|
|
35
|
+
shards: spawn,
|
|
36
|
+
stats: this.stats,
|
|
37
|
+
};
|
|
37
38
|
}
|
|
38
39
|
}
|
|
39
|
-
//# sourceMappingURL=XernerxShardClient.js.map
|
|
40
|
+
//# 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,CAAC;AAQhD,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,eAAe;IAI3D,YAAY,IAAY,EAAE,cAAsC,EAAE,cAA+B;QAC7F,KAAK,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;QAE5B,IAAI,CAAC,KAAK,GA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GAAG,GAAG,CAAC,CAAC;YAC1H,CAAC,CAAC;iBACD,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;gBACnB,IAAI,UAAU,CAAC,EAAE,QAAQ,EAAE,cAAc,EAAW,CAAC,CAAC,IAAI,CAAC,wBAAwB,KAAK,CAAC,EAAE,QAAQ,IAAI,CAAC,IAAI,EAAE,GAAG,KAAK,KAAK,EAAE,CAAC,CAAC;YACnI,CAAC,CAAC,CAAC;QACX,CAAC,CAAC,CAAC;QAEH,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;QAE3B,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;YACxB,MAAM,SAAS,GAAG,WAAW,CAAC,GAAG,EAAE;gBAC/B,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,GAAG,CAAC,CAAC;gBAE9B,IAAI,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE;oBAC1B,IAAI,UAAU,CAAC,EAAE,QAAQ,EAAE,cAAc,EAAW,CAAC,CAAC,IAAI,CACtD,gBAAgB,IAAI,CAAC,KAAK,CAAC,UAAU,eAAe,IAAI,CAAC,IAAI,EAAE,GAAG,cAAc,IAAI,CAAC,KAAK,CAAC,UAAU,gBAAgB,IAAI,CAAC,KAAK,CAAC,SAAS,SAAS,CACrJ,CAAC;oBAEF,aAAa,CAAC,SAAS,CAAC,CAAC;iBAC5B;YACL,CAAC,EAAE,IAAI,CAAC,CAAC;QACb,CAAC,CAAC,CAAC;QAEH,OAAO;YACH,MAAM,EAAE,KAAK;YACb,KAAK,EAAE,IAAI,CAAC,KAAK;SACX,CAAC;IACf,CAAC;CACJ","sourcesContent":["import { ShardingManager, ShardingManagerOptions, Guild, ClientUser } from 'discord.js';\nimport XernerxLog from '../tools/XernerxLog.js';\n\ninterface XernerxOptions {\n log?: {\n info?: boolean;\n };\n}\n\nexport default class XernerxShardClient extends ShardingManager {\n public declare readonly stats;\n public declare user: ClientUser | null;\n\n constructor(file: string, discordOptions: ShardingManagerOptions, xernerxOptions?: XernerxOptions) {\n super(file, discordOptions);\n\n this.stats = { guildCount: 0, userCount: 0, shardCount: 0 };\n\n this.user = null;\n\n this.on('shardCreate', async (shard) => {\n shard\n .on('ready', async () => {\n const guilds = (await shard.fetchClientValue('guilds.cache')) as Array<Guild>;\n const guildCount = guilds.length;\n const userCount = guilds.map((guild) => guild.memberCount).length ? guilds.map((guild) => guild.memberCount).reduce((a, b) => (a += b)) : 0;\n\n this.stats.guildCount += Number(guildCount);\n\n this.stats.userCount += Number(userCount);\n\n this.stats.shardCount++;\n\n this.user = (await shard.fetchClientValue('user')) as ClientUser;\n\n await new XernerxLog({ settings: xernerxOptions } as never).info(`Launched shard ${shard.id} for ${this.user?.tag}!`);\n })\n .on('error', (error) => {\n new XernerxLog({ settings: xernerxOptions } as never).info(`An error occurred in ${shard.id} for ${this.user?.tag}! ${error}`);\n });\n });\n\n const spawn = this.spawn();\n\n spawn.then(async (shards) => {\n const collector = setInterval(() => {\n const index = shards.size - 1;\n\n if (shards.get(index)?.ready) {\n new XernerxLog({ settings: xernerxOptions } as never).info(\n `Launched all ${this.stats.shardCount} shards for ${this.user?.tag}, watching ${this.stats.guildCount} guilds, and ${this.stats.userCount} users!`\n );\n\n clearInterval(collector);\n }\n }, 1000);\n });\n\n return {\n shards: spawn,\n stats: this.stats,\n } as never;\n }\n}\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export default function delay(time: number): Promise<unknown>;
|
|
2
|
-
//# sourceMappingURL=delay.d.ts.map
|
|
2
|
+
//# sourceMappingURL=delay.d.ts.map
|
package/dist/functions/delay.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import XernerxClient from '../client/XernerxClient.js';
|
|
2
|
-
export default function deploy(client: XernerxClient
|
|
3
|
-
//# sourceMappingURL=deploy.d.ts.map
|
|
2
|
+
export default function deploy(client: XernerxClient): void;
|
|
3
|
+
//# sourceMappingURL=deploy.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/functions/deploy.ts"],"names":[],"mappings":"AAIA,OAAO,aAAa,MAAM,4BAA4B,CAAC;AAMvD,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,MAAM,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/functions/deploy.ts"],"names":[],"mappings":"AAIA,OAAO,aAAa,MAAM,4BAA4B,CAAC;AAMvD,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,MAAM,EAAE,aAAa,QAyBnD"}
|
package/dist/functions/deploy.js
CHANGED
|
@@ -1,34 +1,40 @@
|
|
|
1
1
|
import { GatewayVersion, REST, Routes } from 'discord.js';
|
|
2
2
|
import XernerxLog from '../tools/XernerxLog.js';
|
|
3
3
|
import XernerxError from '../tools/XernerxError.js';
|
|
4
|
-
const commands =
|
|
5
|
-
export default function deploy(client
|
|
4
|
+
const commands = [];
|
|
5
|
+
export default function deploy(client) {
|
|
6
6
|
client.prependOnceListener('ready', (client) => {
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
if (client.commands.slash.size)
|
|
8
|
+
client.commands.slash.map((command) => commands.push(command.data.toJSON()));
|
|
9
|
+
if (client.commands.context.size)
|
|
10
|
+
client.commands.context.map((command) => commands.push(command.data.toJSON()));
|
|
11
|
+
if (commands.length <= 0)
|
|
12
|
+
return;
|
|
9
13
|
try {
|
|
10
14
|
if (client.settings.global) {
|
|
11
|
-
put(client, client.settings.global,
|
|
15
|
+
put(client, client.settings.global, commands);
|
|
12
16
|
put(client, !client.settings.global, []);
|
|
13
|
-
}
|
|
14
|
-
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
put(client, !client.settings.global, commands);
|
|
15
20
|
put(client, client.settings.global, []);
|
|
16
21
|
}
|
|
17
|
-
}
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
18
24
|
new XernerxLog(client).error(`An error occurred while deploying the interaction commands!`, error);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
client.settings.global ? 'globally' : 'locally'
|
|
23
|
-
}.`
|
|
24
|
-
);
|
|
25
|
+
}
|
|
26
|
+
finally {
|
|
27
|
+
new XernerxLog(client).info(`Deployed ${[client.commands.message.size, client.commands.slash.size, client.commands.context.size].reduce((a, b) => (a += b))} Commands ${client.settings.global ? 'globally' : `locally in ${client.guilds.cache.get(client.settings.local).name}`}.`);
|
|
25
28
|
}
|
|
26
29
|
});
|
|
27
30
|
}
|
|
28
31
|
function put(client, global, body) {
|
|
29
32
|
const rest = new REST({ version: GatewayVersion }).setToken(client.token);
|
|
30
|
-
if (!global && !client.settings?.local)
|
|
31
|
-
|
|
32
|
-
|
|
33
|
+
if (!global && !client.settings?.local)
|
|
34
|
+
throw new XernerxError(`No guild ID provided as local guild!`);
|
|
35
|
+
if (!global && client.settings?.local)
|
|
36
|
+
rest.put(Routes.applicationGuildCommands(client.user?.id, client.settings.local), { body });
|
|
37
|
+
else
|
|
38
|
+
rest.put(Routes.applicationCommands(client.user?.id), { body });
|
|
33
39
|
}
|
|
34
|
-
//# sourceMappingURL=deploy.js.map
|
|
40
|
+
//# 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;AAEpD,MAAM,QAAQ,
|
|
1
|
+
{"version":3,"file":"deploy.js","sourceRoot":"","sources":["../../src/functions/deploy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,YA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AC,MAAM,CAAC,IAAI,EAAE,EAAY,CAAC,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;AACnF,CAAC","sourcesContent":["import { GatewayVersion, REST, Routes } from 'discord.js';\n\nimport ContextCommandBuilder from '../build/ContextCommandBuilder.js';\nimport SlashCommandBuilder from '../build/SlashCommandBuilder.js';\nimport XernerxClient from '../client/XernerxClient.js';\nimport XernerxLog from '../tools/XernerxLog.js';\nimport XernerxError from '../tools/XernerxError.js';\n\nconst commands: Array<SlashCommandBuilder | ContextCommandBuilder | any> = [];\n\nexport default function deploy(client: XernerxClient) {\n client.prependOnceListener('ready', (client) => {\n if (client.commands.slash.size) client.commands.slash.map((command: SlashCommandBuilder | ContextCommandBuilder) => commands.push(command.data.toJSON()));\n if (client.commands.context.size) client.commands.context.map((command: SlashCommandBuilder | ContextCommandBuilder) => commands.push(command.data.toJSON()));\n\n if (commands.length <= 0) return;\n\n try {\n if (client.settings.global) {\n put(client, client.settings.global, commands);\n put(client, !client.settings.global, []);\n } else {\n put(client, !client.settings.global, commands);\n put(client, client.settings.global, []);\n }\n } catch (error) {\n new XernerxLog(client).error(`An error occurred while deploying the interaction commands!`, error);\n } finally {\n new XernerxLog(client).info(\n `Deployed ${[client.commands.message.size, client.commands.slash.size, client.commands.context.size].reduce((a, b) => (a += b))} Commands ${\n client.settings.global ? 'globally' : `locally in ${client.guilds.cache.get(client.settings.local).name}`\n }.`\n );\n }\n });\n}\n\nfunction put(client: XernerxClient, global: boolean, body: Array<object>) {\n const rest = new REST({ version: GatewayVersion }).setToken(client.token as string);\n\n if (!global && !client.settings?.local) throw new XernerxError(`No guild ID provided as local guild!`);\n\n if (!global && client.settings?.local) rest.put(Routes.applicationGuildCommands(client.user?.id as string, client.settings.local), { body });\n else rest.put(Routes.applicationCommands(client.user?.id as string), { body });\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import XernerxClient from '../client/XernerxClient.js';
|
|
2
2
|
import { XernerxUser } from '../types/extenders.js';
|
|
3
3
|
export default function isOwner(user: Pick<XernerxUser, 'id'>, client: XernerxClient): boolean;
|
|
4
|
-
//# sourceMappingURL=isOwner.d.ts.map
|
|
4
|
+
//# sourceMappingURL=isOwner.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import XernerxClient from '../client/XernerxClient.js';
|
|
2
2
|
import { XernerxUser } from '../types/extenders.js';
|
|
3
3
|
export default function isVoter(user: XernerxUser, client: XernerxClient, token: string, host: 'top.gg'): Promise<void>;
|
|
4
|
-
//# sourceMappingURL=isVoter.d.ts.map
|
|
4
|
+
//# sourceMappingURL=isVoter.d.ts.map
|
package/dist/functions/load.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import XernerxClient from '../client/XernerxClient.js';
|
|
2
2
|
import { FileType } from '../types/types.js';
|
|
3
3
|
export default function load(client: XernerxClient, path: string, type: FileType): Promise<any>;
|
|
4
|
-
//# sourceMappingURL=load.d.ts.map
|
|
4
|
+
//# sourceMappingURL=load.d.ts.map
|
package/dist/functions/load.js
CHANGED
|
@@ -7,7 +7,8 @@ export default async function load(client, path, type) {
|
|
|
7
7
|
file.client = client;
|
|
8
8
|
fileSave(client, file, type);
|
|
9
9
|
return file;
|
|
10
|
-
}
|
|
10
|
+
}
|
|
11
|
+
catch (error) {
|
|
11
12
|
new XernerxLog(client).error(`Couldn't load ${type} ${path.match(/\w*\.js$/gim)?.at(0) || path}`, error);
|
|
12
13
|
}
|
|
13
14
|
}
|
|
@@ -30,4 +31,4 @@ function fileSave(client, file, type) {
|
|
|
30
31
|
break;
|
|
31
32
|
}
|
|
32
33
|
}
|
|
33
|
-
//# sourceMappingURL=load.js.map
|
|
34
|
+
//# sourceMappingURL=load.js.map
|
package/dist/functions/reload.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
var FileTypes;
|
|
2
2
|
(function (FileTypes) {
|
|
3
|
-
FileTypes[
|
|
4
|
-
FileTypes[
|
|
5
|
-
FileTypes[
|
|
6
|
-
FileTypes[
|
|
7
|
-
FileTypes[
|
|
3
|
+
FileTypes["message"] = "MessageCommand";
|
|
4
|
+
FileTypes["slash"] = "SlashCommand";
|
|
5
|
+
FileTypes["context"] = "ContextCommand";
|
|
6
|
+
FileTypes["event"] = "Event";
|
|
7
|
+
FileTypes["inhibitor"] = "Inhibitor";
|
|
8
8
|
})(FileTypes || (FileTypes = {}));
|
|
9
9
|
export default function reload(client, type) {
|
|
10
10
|
const files = [];
|
|
@@ -31,10 +31,13 @@ export default function reload(client, type) {
|
|
|
31
31
|
filedata.fileType = FileTypes[type];
|
|
32
32
|
filedata.filePath = file;
|
|
33
33
|
filedata.client = client;
|
|
34
|
-
if (type === 'message' || type === 'slash' || type === 'context')
|
|
35
|
-
|
|
36
|
-
if (type === '
|
|
34
|
+
if (type === 'message' || type === 'slash' || type === 'context')
|
|
35
|
+
client.commands[type].set(filedata.name, filedata);
|
|
36
|
+
if (type === 'event')
|
|
37
|
+
client.events.set(filedata.name, filedata);
|
|
38
|
+
if (type === 'inhibitor')
|
|
39
|
+
client.inhibitors.set(filedata.name, filedata);
|
|
37
40
|
return filedata;
|
|
38
41
|
});
|
|
39
42
|
}
|
|
40
|
-
//# sourceMappingURL=reload.js.map
|
|
43
|
+
//# sourceMappingURL=reload.js.map
|
|
@@ -6,8 +6,9 @@ export default async function sendWebhook(url, body) {
|
|
|
6
6
|
},
|
|
7
7
|
body: JSON.stringify(body),
|
|
8
8
|
});
|
|
9
|
-
if (response.status === 204)
|
|
9
|
+
if (response.status === 204)
|
|
10
|
+
return true;
|
|
10
11
|
const data = await response.json();
|
|
11
12
|
return data;
|
|
12
13
|
}
|
|
13
|
-
//# sourceMappingURL=sendWebhook.js.map
|
|
14
|
+
//# sourceMappingURL=sendWebhook.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import XernerxClient from '../main.js';
|
|
2
2
|
import { PresenceOptions } from '../types/interfaces.js';
|
|
3
|
-
export default function setPresence(client: XernerxClient, options: PresenceOptions): import(
|
|
4
|
-
//# sourceMappingURL=setPresence.d.ts.map
|
|
3
|
+
export default function setPresence(client: XernerxClient, options: PresenceOptions): import("discord.js").ClientPresence | undefined;
|
|
4
|
+
//# sourceMappingURL=setPresence.d.ts.map
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
export default function setPresence(client, options) {
|
|
2
|
-
const presence = () =>
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
});
|
|
2
|
+
const presence = () => client.user?.setPresence({
|
|
3
|
+
activities: [
|
|
4
|
+
{
|
|
5
|
+
name: options.text,
|
|
6
|
+
type: options.type,
|
|
7
|
+
url: options.url,
|
|
8
|
+
},
|
|
9
|
+
],
|
|
10
|
+
status: options.status,
|
|
11
|
+
});
|
|
13
12
|
let response = presence();
|
|
14
13
|
if (options.interval)
|
|
15
14
|
setInterval(() => {
|
|
@@ -17,4 +16,4 @@ export default function setPresence(client, options) {
|
|
|
17
16
|
}, options.interval);
|
|
18
17
|
return response;
|
|
19
18
|
}
|
|
20
|
-
//# sourceMappingURL=setPresence.js.map
|
|
19
|
+
//# sourceMappingURL=setPresence.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import XernerxClient from '../client/XernerxClient.js';
|
|
2
2
|
import { XernerxMessage, XernerxSlashInteraction, XernerxUser, XernerxUserContextInteraction } from '../types/extenders.js';
|
|
3
3
|
export declare function xernerxUser(event: XernerxMessage | XernerxSlashInteraction | XernerxUserContextInteraction | XernerxUserContextInteraction, client: XernerxClient): Promise<XernerxUser>;
|
|
4
|
-
//# sourceMappingURL=xernerxUser.d.ts.map
|
|
4
|
+
//# sourceMappingURL=xernerxUser.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommandHandler.d.ts","sourceRoot":"","sources":["../../src/handlers/CommandHandler.ts"],"names":[],"mappings":"AAIA,OAAO,aAAa,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC3G,OAAO,OAAO,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"CommandHandler.d.ts","sourceRoot":"","sources":["../../src/handlers/CommandHandler.ts"],"names":[],"mappings":"AAIA,OAAO,aAAa,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC3G,OAAO,OAAO,MAAM,cAAc,CAAC;AAcnC,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,OAAO;gBACnC,MAAM,EAAE,aAAa;IAI1B,mBAAmB,CAAC,OAAO,EAAE,qBAAqB;IA2DlD,iBAAiB,CAAC,OAAO,EAAE,mBAAmB;IA2C9C,mBAAmB,CAAC,OAAO,EAAE,qBAAqB;YA4C3C,iBAAiB;YAuGjB,eAAe;YA+Bf,iBAAiB;YAoBjB,IAAI;CAoBrB"}
|