xernerx 4.15.0 → 4.15.2
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/{cjs/utils → utils}/InteractionUtil.d.ts +1 -1
- package/dist/{mjs/utils → utils}/InteractionUtil.js +4 -3
- package/dist/{cjs/utils → utils}/MessageUtil.d.ts +1 -1
- package/dist/{mjs/utils → utils}/MessageUtil.js +4 -3
- package/package.json +3 -4
- package/dist/cjs/build/XernerxContextCommand.js +0 -124
- package/dist/cjs/build/XernerxEvent.js +0 -34
- package/dist/cjs/build/XernerxInhibitor.js +0 -30
- package/dist/cjs/build/XernerxMessageCommand.js +0 -122
- package/dist/cjs/build/XernerxSlashCommand.js +0 -180
- package/dist/cjs/client/XernerxClient.js +0 -105
- package/dist/cjs/client/XernerxShardClient.js +0 -56
- package/dist/cjs/functions/deploy.js +0 -66
- package/dist/cjs/functions/load.js +0 -38
- package/dist/cjs/functions/reload.js +0 -33
- package/dist/cjs/functions/setPresence.js +0 -24
- package/dist/cjs/functions/xernerxUser.js +0 -15
- package/dist/cjs/handlers/CommandHandler.js +0 -342
- package/dist/cjs/handlers/EventHandler.js +0 -32
- package/dist/cjs/handlers/ExtensionHandler.js +0 -32
- package/dist/cjs/handlers/Handler.js +0 -48
- package/dist/cjs/handlers/InhibitorHandler.js +0 -34
- package/dist/cjs/handlers/IntegrationHandler.js +0 -29
- package/dist/cjs/main.js +0 -36
- package/dist/cjs/models/Arguments.js +0 -159
- package/dist/cjs/models/Cooldowns.js +0 -36
- package/dist/cjs/tools/XernerxError.js +0 -14
- package/dist/cjs/tools/XernerxIntents.js +0 -27
- package/dist/cjs/tools/XernerxLog.js +0 -98
- package/dist/cjs/tools/XernerxText.js +0 -92
- package/dist/cjs/types/extenders.js +0 -3
- package/dist/cjs/types/interfaces.js +0 -3
- package/dist/cjs/types/types.js +0 -3
- package/dist/cjs/utils/ClientUtil.js +0 -84
- package/dist/cjs/utils/InteractionUtil.js +0 -156
- package/dist/cjs/utils/MessageUtil.js +0 -170
- package/dist/cjs/utils/Util.js +0 -14
- package/dist/cjs/validators/commandValidation.js +0 -127
- package/dist/cjs/validators/inhibitorValidations.js +0 -49
- package/dist/mjs/build/XernerxContextCommand.d.ts +0 -53
- package/dist/mjs/build/XernerxEvent.d.ts +0 -25
- package/dist/mjs/build/XernerxInhibitor.d.ts +0 -29
- package/dist/mjs/build/XernerxMessageCommand.d.ts +0 -57
- package/dist/mjs/build/XernerxSlashCommand.d.ts +0 -69
- package/dist/mjs/client/XernerxClient.d.ts +0 -53
- package/dist/mjs/client/XernerxShardClient.d.ts +0 -21
- package/dist/mjs/functions/deploy.d.ts +0 -3
- package/dist/mjs/functions/load.d.ts +0 -4
- package/dist/mjs/functions/reload.d.ts +0 -3
- package/dist/mjs/functions/setPresence.d.ts +0 -4
- package/dist/mjs/functions/xernerxUser.d.ts +0 -4
- package/dist/mjs/handlers/CommandHandler.d.ts +0 -16
- package/dist/mjs/handlers/EventHandler.d.ts +0 -9
- package/dist/mjs/handlers/ExtensionHandler.d.ts +0 -9
- package/dist/mjs/handlers/Handler.d.ts +0 -14
- package/dist/mjs/handlers/InhibitorHandler.d.ts +0 -9
- package/dist/mjs/handlers/IntegrationHandler.d.ts +0 -15
- package/dist/mjs/main.d.ts +0 -40
- package/dist/mjs/models/Arguments.d.ts +0 -9
- package/dist/mjs/models/Cooldowns.d.ts +0 -11
- package/dist/mjs/tools/XernerxError.d.ts +0 -7
- package/dist/mjs/tools/XernerxIntents.d.ts +0 -5
- package/dist/mjs/tools/XernerxLog.d.ts +0 -28
- package/dist/mjs/tools/XernerxText.d.ts +0 -30
- package/dist/mjs/types/extenders.d.ts +0 -61
- package/dist/mjs/types/interfaces.d.ts +0 -256
- package/dist/mjs/types/types.d.ts +0 -14
- package/dist/mjs/utils/ClientUtil.d.ts +0 -19
- package/dist/mjs/utils/InteractionUtil.d.ts +0 -25
- package/dist/mjs/utils/MessageUtil.d.ts +0 -26
- package/dist/mjs/utils/Util.d.ts +0 -9
- package/dist/mjs/validators/commandValidation.d.ts +0 -7
- package/dist/mjs/validators/inhibitorValidations.d.ts +0 -9
- /package/dist/{cjs/build → build}/XernerxContextCommand.d.ts +0 -0
- /package/dist/{mjs/build → build}/XernerxContextCommand.js +0 -0
- /package/dist/{cjs/build → build}/XernerxEvent.d.ts +0 -0
- /package/dist/{mjs/build → build}/XernerxEvent.js +0 -0
- /package/dist/{cjs/build → build}/XernerxInhibitor.d.ts +0 -0
- /package/dist/{mjs/build → build}/XernerxInhibitor.js +0 -0
- /package/dist/{cjs/build → build}/XernerxMessageCommand.d.ts +0 -0
- /package/dist/{mjs/build → build}/XernerxMessageCommand.js +0 -0
- /package/dist/{cjs/build → build}/XernerxSlashCommand.d.ts +0 -0
- /package/dist/{mjs/build → build}/XernerxSlashCommand.js +0 -0
- /package/dist/{cjs/client → client}/XernerxClient.d.ts +0 -0
- /package/dist/{mjs/client → client}/XernerxClient.js +0 -0
- /package/dist/{cjs/client → client}/XernerxShardClient.d.ts +0 -0
- /package/dist/{mjs/client → client}/XernerxShardClient.js +0 -0
- /package/dist/{cjs/functions → functions}/deploy.d.ts +0 -0
- /package/dist/{mjs/functions → functions}/deploy.js +0 -0
- /package/dist/{cjs/functions → functions}/load.d.ts +0 -0
- /package/dist/{mjs/functions → functions}/load.js +0 -0
- /package/dist/{cjs/functions → functions}/reload.d.ts +0 -0
- /package/dist/{mjs/functions → functions}/reload.js +0 -0
- /package/dist/{cjs/functions → functions}/setPresence.d.ts +0 -0
- /package/dist/{mjs/functions → functions}/setPresence.js +0 -0
- /package/dist/{cjs/functions → functions}/xernerxUser.d.ts +0 -0
- /package/dist/{mjs/functions → functions}/xernerxUser.js +0 -0
- /package/dist/{cjs/handlers → handlers}/CommandHandler.d.ts +0 -0
- /package/dist/{mjs/handlers → handlers}/CommandHandler.js +0 -0
- /package/dist/{cjs/handlers → handlers}/EventHandler.d.ts +0 -0
- /package/dist/{mjs/handlers → handlers}/EventHandler.js +0 -0
- /package/dist/{cjs/handlers → handlers}/ExtensionHandler.d.ts +0 -0
- /package/dist/{mjs/handlers → handlers}/ExtensionHandler.js +0 -0
- /package/dist/{cjs/handlers → handlers}/Handler.d.ts +0 -0
- /package/dist/{mjs/handlers → handlers}/Handler.js +0 -0
- /package/dist/{cjs/handlers → handlers}/InhibitorHandler.d.ts +0 -0
- /package/dist/{mjs/handlers → handlers}/InhibitorHandler.js +0 -0
- /package/dist/{cjs/handlers → handlers}/IntegrationHandler.d.ts +0 -0
- /package/dist/{mjs/handlers → handlers}/IntegrationHandler.js +0 -0
- /package/dist/{cjs/main.d.ts → main.d.ts} +0 -0
- /package/dist/{mjs/main.js → main.js} +0 -0
- /package/dist/{cjs/models → models}/Arguments.d.ts +0 -0
- /package/dist/{mjs/models → models}/Arguments.js +0 -0
- /package/dist/{cjs/models → models}/Cooldowns.d.ts +0 -0
- /package/dist/{mjs/models → models}/Cooldowns.js +0 -0
- /package/dist/{cjs/tools → tools}/XernerxError.d.ts +0 -0
- /package/dist/{mjs/tools → tools}/XernerxError.js +0 -0
- /package/dist/{cjs/tools → tools}/XernerxIntents.d.ts +0 -0
- /package/dist/{mjs/tools → tools}/XernerxIntents.js +0 -0
- /package/dist/{cjs/tools → tools}/XernerxLog.d.ts +0 -0
- /package/dist/{mjs/tools → tools}/XernerxLog.js +0 -0
- /package/dist/{cjs/tools → tools}/XernerxText.d.ts +0 -0
- /package/dist/{mjs/tools → tools}/XernerxText.js +0 -0
- /package/dist/{cjs/types → types}/extenders.d.ts +0 -0
- /package/dist/{mjs/types → types}/extenders.js +0 -0
- /package/dist/{cjs/types → types}/interfaces.d.ts +0 -0
- /package/dist/{mjs/types → types}/interfaces.js +0 -0
- /package/dist/{cjs/types → types}/types.d.ts +0 -0
- /package/dist/{mjs/types → types}/types.js +0 -0
- /package/dist/{cjs/utils → utils}/ClientUtil.d.ts +0 -0
- /package/dist/{mjs/utils → utils}/ClientUtil.js +0 -0
- /package/dist/{cjs/utils → utils}/Util.d.ts +0 -0
- /package/dist/{mjs/utils → utils}/Util.js +0 -0
- /package/dist/{cjs/validators → validators}/commandValidation.d.ts +0 -0
- /package/dist/{mjs/validators → validators}/commandValidation.js +0 -0
- /package/dist/{cjs/validators → validators}/inhibitorValidations.d.ts +0 -0
- /package/dist/{mjs/validators → validators}/inhibitorValidations.js +0 -0
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/** @format */
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
const discord_js_1 = require("discord.js");
|
|
5
|
-
const zod_1 = require("zod");
|
|
6
|
-
const CommandHandler_js_1 = __importDefault(require("../handlers/CommandHandler.js"));
|
|
7
|
-
const EventHandler_js_1 = __importDefault(require("../handlers/EventHandler.js"));
|
|
8
|
-
const InhibitorHandler_js_1 = __importDefault(require("../handlers/InhibitorHandler.js"));
|
|
9
|
-
const IntegrationHandler_js_1 = __importDefault(require("../handlers/IntegrationHandler.js"));
|
|
10
|
-
const XernerxLog_js_1 = __importDefault(require("../tools/XernerxLog.js"));
|
|
11
|
-
const ClientUtil_js_1 = __importDefault(require("../utils/ClientUtil.js"));
|
|
12
|
-
const ExtensionHandler_js_1 = __importDefault(require("../handlers/ExtensionHandler.js"));
|
|
13
|
-
const deploy_js_1 = __importDefault(require("../functions/deploy.js"));
|
|
14
|
-
const Cooldowns_js_1 = __importDefault(require("../models/Cooldowns.js"));
|
|
15
|
-
class XernerxClient extends discord_js_1.Client {
|
|
16
|
-
constructor(discordOptions, xernerxOptions, config) {
|
|
17
|
-
super(discordOptions);
|
|
18
|
-
this.settings = zod_1.z
|
|
19
|
-
.object({
|
|
20
|
-
local: zod_1.z.string(),
|
|
21
|
-
global: zod_1.z.boolean().default(false).optional(),
|
|
22
|
-
ownerId: zod_1.z.string().or(zod_1.z.array(zod_1.z.string())).default([]),
|
|
23
|
-
ceaseless: zod_1.z.boolean().default(false),
|
|
24
|
-
permissions: zod_1.z
|
|
25
|
-
.object({
|
|
26
|
-
client: zod_1.z.array(zod_1.z.string()).or(zod_1.z.null()).default(null),
|
|
27
|
-
user: zod_1.z.array(zod_1.z.string()).or(zod_1.z.null()).default(null),
|
|
28
|
-
dm: zod_1.z.boolean().default(false),
|
|
29
|
-
})
|
|
30
|
-
.optional(),
|
|
31
|
-
ignore: zod_1.z
|
|
32
|
-
.object({
|
|
33
|
-
owner: zod_1.z.boolean().default(false),
|
|
34
|
-
self: zod_1.z.boolean().default(true),
|
|
35
|
-
bots: zod_1.z.boolean().default(true),
|
|
36
|
-
system: zod_1.z.boolean().default(true),
|
|
37
|
-
users: zod_1.z.array(zod_1.z.string()).default([]),
|
|
38
|
-
channels: zod_1.z.array(zod_1.z.string()).default([]),
|
|
39
|
-
guilds: zod_1.z.array(zod_1.z.string()).default([]),
|
|
40
|
-
})
|
|
41
|
-
.optional(),
|
|
42
|
-
log: zod_1.z
|
|
43
|
-
.object({
|
|
44
|
-
ready: zod_1.z.boolean().default(false),
|
|
45
|
-
info: zod_1.z.boolean().default(false),
|
|
46
|
-
warn: zod_1.z.boolean().default(false),
|
|
47
|
-
error: zod_1.z.boolean().default(false),
|
|
48
|
-
table: zod_1.z.array(zod_1.z.string()).or(zod_1.z.null()).default(null),
|
|
49
|
-
})
|
|
50
|
-
.or(zod_1.z.boolean())
|
|
51
|
-
.optional(),
|
|
52
|
-
cooldown: zod_1.z
|
|
53
|
-
.object({
|
|
54
|
-
command: zod_1.z.number().default(0),
|
|
55
|
-
cache: zod_1.z.number().default(0),
|
|
56
|
-
collections: zod_1.z.array(zod_1.z.string()).default(['commands']),
|
|
57
|
-
})
|
|
58
|
-
.optional(),
|
|
59
|
-
})
|
|
60
|
-
.parse(xernerxOptions);
|
|
61
|
-
this.config = config || null;
|
|
62
|
-
this.commands = {
|
|
63
|
-
message: new discord_js_1.Collection(),
|
|
64
|
-
slash: new discord_js_1.Collection(),
|
|
65
|
-
context: new discord_js_1.Collection(),
|
|
66
|
-
};
|
|
67
|
-
this.events = new discord_js_1.Collection();
|
|
68
|
-
this.inhibitors = new discord_js_1.Collection();
|
|
69
|
-
this.util = new ClientUtil_js_1.default(this);
|
|
70
|
-
this.stats = {
|
|
71
|
-
guildCount: this.guilds.cache.size,
|
|
72
|
-
userCount: 0,
|
|
73
|
-
shardId: 0,
|
|
74
|
-
shardCount: this.options.shardCount || 1,
|
|
75
|
-
voteCount: 0,
|
|
76
|
-
};
|
|
77
|
-
this.dbl = {};
|
|
78
|
-
this.cache = {
|
|
79
|
-
messages: new discord_js_1.Collection(),
|
|
80
|
-
cooldowns: new discord_js_1.Collection(),
|
|
81
|
-
};
|
|
82
|
-
this.cooldowns = new Cooldowns_js_1.default(this, xernerxOptions.cooldown?.collections);
|
|
83
|
-
this.modules = {
|
|
84
|
-
options: {},
|
|
85
|
-
commandHandler: new CommandHandler_js_1.default(this),
|
|
86
|
-
eventHandler: new EventHandler_js_1.default(this),
|
|
87
|
-
inhibitorHandler: new InhibitorHandler_js_1.default(this),
|
|
88
|
-
integrationHandler: new IntegrationHandler_js_1.default(this),
|
|
89
|
-
extensionHandler: new ExtensionHandler_js_1.default(this),
|
|
90
|
-
};
|
|
91
|
-
return this;
|
|
92
|
-
}
|
|
93
|
-
async connect(token) {
|
|
94
|
-
const login = this.login(token);
|
|
95
|
-
(0, deploy_js_1.default)(this);
|
|
96
|
-
if (this.settings.ceaseless) {
|
|
97
|
-
process.on('unhandledRejection', (error) => {
|
|
98
|
-
new XernerxLog_js_1.default(this).error('An uncaught error happpened, this is triggered from the ceaseless setting.', error);
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
new XernerxLog_js_1.default(this).ready();
|
|
102
|
-
return login;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
exports.default = XernerxClient;
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/** @format */
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
const discord_js_1 = require("discord.js");
|
|
5
|
-
const dumfunctions_1 = require("dumfunctions");
|
|
6
|
-
const XernerxLog_js_1 = __importDefault(require("../tools/XernerxLog.js"));
|
|
7
|
-
class XernerxShardClient extends discord_js_1.ShardingManager {
|
|
8
|
-
constructor(file, discordOptions, xernerxOptions, data = {}) {
|
|
9
|
-
super(file, discordOptions);
|
|
10
|
-
this.stats = { guildCount: 0, userCount: 0, shardCount: 0, voteCount: 0, shards: {} };
|
|
11
|
-
this.user = null;
|
|
12
|
-
this.on('shardCreate', async (shard) => {
|
|
13
|
-
shard
|
|
14
|
-
.on('ready', async () => {
|
|
15
|
-
await new Promise((resolve) => setTimeout(resolve, 250));
|
|
16
|
-
const stats = (await shard.fetchClientValue('stats'));
|
|
17
|
-
this.stats.shards[String(shard.id)] = stats;
|
|
18
|
-
this.user = (await shard.fetchClientValue('user'));
|
|
19
|
-
this.stats.guildCount += stats.guildCount;
|
|
20
|
-
this.stats.userCount += stats.userCount;
|
|
21
|
-
this.stats.shardCount++;
|
|
22
|
-
this.stats.voteCount = stats.voteCount;
|
|
23
|
-
shard.send({ type: 'xernerx', data: { shardId: shard.id, sharded: true } });
|
|
24
|
-
shard.send({ type: 'client', data });
|
|
25
|
-
await new XernerxLog_js_1.default({ settings: xernerxOptions }).info(`Launched shard ${dumfunctions_1.Style.log(String(shard.id), { color: dumfunctions_1.Style.TextColor.Cyan })} for ${dumfunctions_1.Style.log(this.user?.tag, { color: dumfunctions_1.Style.TextColor.Blue })}! ${xernerxOptions?.timeout ? `Automatically killing in ${dumfunctions_1.Style.log(String(xernerxOptions.timeout), { color: dumfunctions_1.Style.TextColor.Cyan })}ms.` : ''}`);
|
|
26
|
-
})
|
|
27
|
-
.on('error', (error) => {
|
|
28
|
-
new XernerxLog_js_1.default({ settings: xernerxOptions }).info(`An error occurred in ${dumfunctions_1.Style.log(String(shard.id), { color: dumfunctions_1.Style.TextColor.Cyan })} for ${dumfunctions_1.Style.log(String(this.user?.tag), { color: dumfunctions_1.Style.TextColor.Blue })}! ${error}`);
|
|
29
|
-
});
|
|
30
|
-
if (xernerxOptions?.timeout)
|
|
31
|
-
setTimeout(() => {
|
|
32
|
-
new XernerxLog_js_1.default({ settings: xernerxOptions }).warn(`Automatically killing shard ${dumfunctions_1.Style.log(String(shard.id), { color: dumfunctions_1.Style.TextColor.Cyan })} on ${dumfunctions_1.Style.log(String(shard.manager.user?.tag), {
|
|
33
|
-
color: dumfunctions_1.Style.TextColor.Blue,
|
|
34
|
-
})}!`);
|
|
35
|
-
shard.kill();
|
|
36
|
-
}, xernerxOptions.timeout);
|
|
37
|
-
});
|
|
38
|
-
const spawn = this.spawn();
|
|
39
|
-
this.spawner = spawn;
|
|
40
|
-
spawn.then(async (shards) => {
|
|
41
|
-
const collector = setInterval(() => {
|
|
42
|
-
const index = shards.size - 1;
|
|
43
|
-
if (shards.get(index)?.ready) {
|
|
44
|
-
clearInterval(collector);
|
|
45
|
-
new XernerxLog_js_1.default({ settings: xernerxOptions }).info(`All Shards launched for ${dumfunctions_1.Style.log(String(this.user?.tag), {
|
|
46
|
-
color: dumfunctions_1.Style.TextColor.Blue,
|
|
47
|
-
})} with a total of ${dumfunctions_1.Style.log(String(this.stats.shardCount), { color: dumfunctions_1.Style.TextColor.Cyan })} shard${this.stats.shardCount > 1 ? 's' : ''}, watching ${dumfunctions_1.Style.log(String(this.stats.guildCount), {
|
|
48
|
-
color: dumfunctions_1.Style.TextColor.Cyan,
|
|
49
|
-
})} guild${this.stats.guildCount > 1 ? 's' : ''}, and ${dumfunctions_1.Style.log(String(this.stats.userCount), { color: dumfunctions_1.Style.TextColor.Cyan })} user${this.stats.userCount > 1 ? 's' : ''}!`);
|
|
50
|
-
}
|
|
51
|
-
}, 1000);
|
|
52
|
-
});
|
|
53
|
-
return this;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
exports.default = XernerxShardClient;
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/** @format */
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
const discord_js_1 = require("discord.js");
|
|
5
|
-
const dumfunctions_1 = require("dumfunctions");
|
|
6
|
-
const XernerxLog_js_1 = __importDefault(require("../tools/XernerxLog.js"));
|
|
7
|
-
const XernerxError_js_1 = __importDefault(require("../tools/XernerxError.js"));
|
|
8
|
-
const globalCommands = [];
|
|
9
|
-
const localCommands = [];
|
|
10
|
-
function deploy(client) {
|
|
11
|
-
const commands = [];
|
|
12
|
-
function stats() {
|
|
13
|
-
client.stats.guildCount = client.guilds.cache.size;
|
|
14
|
-
client.stats.userCount = client.guilds.cache.map((g) => g.memberCount || g.approximateMemberCount || 0).reduce((a, b) => (a += b), 0);
|
|
15
|
-
}
|
|
16
|
-
process.on('message', (message) => {
|
|
17
|
-
if (message.type == 'xernerx')
|
|
18
|
-
client.stats.shardId = message?.data?.shardId;
|
|
19
|
-
if (message.type == 'client')
|
|
20
|
-
client.data = message.data;
|
|
21
|
-
});
|
|
22
|
-
client.on('messageCreate', stats);
|
|
23
|
-
client.on('interactionCreate', stats);
|
|
24
|
-
client.prependOnceListener('ready', (client) => {
|
|
25
|
-
stats();
|
|
26
|
-
client.commands.slash.map((command) => commands.push(command));
|
|
27
|
-
client.commands.context.map((command) => commands.push(command));
|
|
28
|
-
client.commands.slash.map((command) => commands.push(command));
|
|
29
|
-
if (client.commands.slash.size)
|
|
30
|
-
client.commands.slash.map((command) => (command.global ? globalCommands.push(command.data.toJSON()) : localCommands.push(command.data.toJSON())));
|
|
31
|
-
if (client.commands.context.size)
|
|
32
|
-
client.commands.context.map((command) => (command.global ? globalCommands.push(command.data.toJSON()) : localCommands.push(command.data.toJSON())));
|
|
33
|
-
if (globalCommands.length <= 0 && localCommands.length <= 0)
|
|
34
|
-
return;
|
|
35
|
-
try {
|
|
36
|
-
if (client.settings.global) {
|
|
37
|
-
put(client, client.settings.global, globalCommands);
|
|
38
|
-
put(client, !client.settings.global, localCommands);
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
put(client, !client.settings.global, [...globalCommands, ...localCommands]);
|
|
42
|
-
put(client, client.settings.global, []);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
catch (error) {
|
|
46
|
-
new XernerxLog_js_1.default(client).error(`An error occurred while deploying the commands!`, error);
|
|
47
|
-
}
|
|
48
|
-
finally {
|
|
49
|
-
new XernerxLog_js_1.default(client).info(`Deployed ${dumfunctions_1.Style.log(String(commands.filter((command) => command.global).length), {
|
|
50
|
-
color: dumfunctions_1.Style.TextColor.Cyan,
|
|
51
|
-
})} Commands ${client.settings.global
|
|
52
|
-
? dumfunctions_1.Style.log('globally', { color: dumfunctions_1.Style.TextColor.Green })
|
|
53
|
-
: `${dumfunctions_1.Style.log('locally', { color: dumfunctions_1.Style.TextColor.Red })} in ${dumfunctions_1.Style.log(client.guilds.cache.get(client.settings.local)?.name, { color: dumfunctions_1.Style.TextColor.Blue })}`}.`);
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
exports.default = deploy;
|
|
58
|
-
function put(client, global, body) {
|
|
59
|
-
const rest = new discord_js_1.REST({ version: discord_js_1.GatewayVersion }).setToken(client.token);
|
|
60
|
-
if (!global && !client.settings?.local)
|
|
61
|
-
throw new XernerxError_js_1.default(`No guild ID provided as local guild!`);
|
|
62
|
-
if (!global && client.settings?.local)
|
|
63
|
-
return rest.put(discord_js_1.Routes.applicationGuildCommands(client.user?.id, client.settings.local), { body });
|
|
64
|
-
else
|
|
65
|
-
return rest.put(discord_js_1.Routes.applicationCommands(client.user?.id), { body });
|
|
66
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/** @format */
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
const XernerxLog_js_1 = __importDefault(require("../tools/XernerxLog.js"));
|
|
5
|
-
async function load(client, path, type) {
|
|
6
|
-
try {
|
|
7
|
-
let file = new (await import(`file://${path}`)).default();
|
|
8
|
-
file.filetype = type;
|
|
9
|
-
file.filepath = path;
|
|
10
|
-
file.client = client;
|
|
11
|
-
file.util = {};
|
|
12
|
-
fileSave(client, file, type);
|
|
13
|
-
return file;
|
|
14
|
-
}
|
|
15
|
-
catch (error) {
|
|
16
|
-
new XernerxLog_js_1.default(client).error(`Couldn't load ${type} ${path.match(/\w*\.js$/gim)?.at(0) || path}`, error);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
exports.default = load;
|
|
20
|
-
function fileSave(client, file, type) {
|
|
21
|
-
switch (type) {
|
|
22
|
-
case 'MessageCommand':
|
|
23
|
-
client.commands.message.set(file.name, file);
|
|
24
|
-
break;
|
|
25
|
-
case 'SlashCommand':
|
|
26
|
-
client.commands.slash.set(file.name, file);
|
|
27
|
-
break;
|
|
28
|
-
case 'ContextCommand':
|
|
29
|
-
client.commands.context.set(file.name, file);
|
|
30
|
-
break;
|
|
31
|
-
case 'Inhibitor':
|
|
32
|
-
client.inhibitors.set(file.name, file);
|
|
33
|
-
break;
|
|
34
|
-
case 'Event':
|
|
35
|
-
client.events.set(file.name, file);
|
|
36
|
-
break;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/** @format */
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
const path = __importStar(require("path"));
|
|
5
|
-
const fs = __importStar(require("fs"));
|
|
6
|
-
const load_js_1 = __importDefault(require("./load.js"));
|
|
7
|
-
async function reload(client, type) {
|
|
8
|
-
switch (type) {
|
|
9
|
-
case 'message': {
|
|
10
|
-
client.commands.message.clear();
|
|
11
|
-
if (!client.modules.options.message)
|
|
12
|
-
return null;
|
|
13
|
-
const directory = path.resolve(client.modules.options.message?.directory);
|
|
14
|
-
for (const file of fs.readdirSync(directory)) {
|
|
15
|
-
(0, load_js_1.default)(client, `${directory}\\${file}`, 'MessageCommand');
|
|
16
|
-
}
|
|
17
|
-
return true;
|
|
18
|
-
}
|
|
19
|
-
case 'slash': {
|
|
20
|
-
return client.commands.slash.clear();
|
|
21
|
-
}
|
|
22
|
-
case 'context': {
|
|
23
|
-
return client.commands.context.clear();
|
|
24
|
-
}
|
|
25
|
-
case 'events': {
|
|
26
|
-
return client.events.clear();
|
|
27
|
-
}
|
|
28
|
-
case 'inhibitors': {
|
|
29
|
-
return client.inhibitors.clear();
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
exports.default = reload;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/** @format */
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
const discord_js_1 = require("discord.js");
|
|
5
|
-
const dumfunctions_1 = require("dumfunctions");
|
|
6
|
-
function setPresence(client, options) {
|
|
7
|
-
const presence = () => client.user?.setPresence({
|
|
8
|
-
activities: [
|
|
9
|
-
{
|
|
10
|
-
name: options.text,
|
|
11
|
-
type: discord_js_1.ActivityType[dumfunctions_1.Style.titleCase(options.type || 'Custom')],
|
|
12
|
-
url: options.url,
|
|
13
|
-
},
|
|
14
|
-
],
|
|
15
|
-
status: options.status,
|
|
16
|
-
});
|
|
17
|
-
let response = presence();
|
|
18
|
-
if (options.interval)
|
|
19
|
-
setInterval(() => {
|
|
20
|
-
response = presence();
|
|
21
|
-
}, options.interval);
|
|
22
|
-
return response;
|
|
23
|
-
}
|
|
24
|
-
exports.default = setPresence;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/** @format */
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.xernerxUser = void 0;
|
|
5
|
-
async function xernerxUser(event, client) {
|
|
6
|
-
const author = event.author || event.user;
|
|
7
|
-
author.owner = isOwner(client, author);
|
|
8
|
-
if (client.dbl.validate)
|
|
9
|
-
author.voted = await client?.dbl?.validate(author);
|
|
10
|
-
return author;
|
|
11
|
-
}
|
|
12
|
-
exports.xernerxUser = xernerxUser;
|
|
13
|
-
function isOwner(client, user) {
|
|
14
|
-
return client.settings.ownerId.includes(user.id);
|
|
15
|
-
}
|