xernerx 4.17.3 → 4.17.5
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 +75 -47
- package/dist/build/XernerxContextCommand.js +119 -115
- package/dist/build/XernerxEvent.d.ts +10 -10
- package/dist/build/XernerxEvent.js +17 -17
- package/dist/build/XernerxInhibitor.d.ts +39 -15
- package/dist/build/XernerxInhibitor.js +18 -18
- package/dist/build/XernerxMessageCommand.d.ts +78 -52
- package/dist/build/XernerxMessageCommand.js +118 -114
- package/dist/build/XernerxSlashCommand.d.ts +96 -62
- package/dist/build/XernerxSlashCommand.js +176 -172
- package/dist/client/XernerxClient.d.ts +55 -45
- package/dist/client/XernerxClient.js +83 -88
- package/dist/client/XernerxShardClient.d.ts +14 -14
- package/dist/client/XernerxShardClient.js +61 -47
- package/dist/functions/deploy.js +45 -52
- package/dist/functions/load.js +28 -29
- package/dist/functions/reload.js +23 -24
- package/dist/functions/setPresence.d.ts +1 -1
- package/dist/functions/setPresence.js +17 -16
- package/dist/functions/xernerxUser.js +5 -6
- package/dist/handlers/CommandHandler.d.ts +10 -10
- package/dist/handlers/CommandHandler.js +311 -336
- package/dist/handlers/EventHandler.d.ts +3 -3
- package/dist/handlers/EventHandler.js +48 -21
- package/dist/handlers/ExtensionHandler.d.ts +3 -3
- package/dist/handlers/ExtensionHandler.js +23 -23
- package/dist/handlers/Handler.d.ts +19 -14
- package/dist/handlers/Handler.js +46 -50
- package/dist/handlers/InhibitorHandler.d.ts +3 -3
- package/dist/handlers/InhibitorHandler.js +25 -23
- package/dist/handlers/IntegrationHandler.d.ts +6 -6
- package/dist/handlers/IntegrationHandler.js +20 -20
- package/dist/main.d.ts +28 -21
- package/dist/main.js +28 -21
- package/dist/models/Arguments.d.ts +4 -1
- package/dist/models/Arguments.js +134 -149
- package/dist/models/Cooldowns.d.ts +6 -6
- package/dist/models/Cooldowns.js +25 -29
- package/dist/tools/XernerxError.d.ts +4 -4
- package/dist/tools/XernerxError.js +8 -8
- package/dist/tools/XernerxIntents.d.ts +2 -2
- package/dist/tools/XernerxIntents.js +21 -21
- package/dist/tools/XernerxLog.d.ts +23 -23
- package/dist/tools/XernerxLog.js +125 -110
- package/dist/tools/XernerxText.d.ts +23 -23
- package/dist/tools/XernerxText.js +79 -89
- package/dist/types/extenders.d.ts +55 -47
- package/dist/types/interfaces.d.ts +192 -189
- package/dist/types/types.d.ts +104 -5
- package/dist/utils/ClientUtil.d.ts +12 -9
- package/dist/utils/ClientUtil.js +96 -79
- package/dist/utils/InteractionUtil.d.ts +13 -13
- package/dist/utils/InteractionUtil.js +148 -147
- package/dist/utils/MessageUtil.d.ts +14 -14
- package/dist/utils/MessageUtil.js +162 -161
- package/dist/utils/Util.d.ts +4 -4
- package/dist/utils/Util.js +7 -7
- package/dist/validators/commandValidation.d.ts +4 -1
- package/dist/validators/commandValidation.js +157 -114
- package/dist/validators/inhibitorValidations.d.ts +21 -2
- package/dist/validators/inhibitorValidations.js +39 -39
- package/package.json +3 -3
|
@@ -3,176 +3,180 @@ import Discord, { SlashCommandSubcommandBuilder, SlashCommandSubcommandGroupBuil
|
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import XernerxLog from '../tools/XernerxLog.js';
|
|
5
5
|
export default class XernerxSlashCommand {
|
|
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
|
-
|
|
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
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
6
|
+
constructor(id, options) {
|
|
7
|
+
this.id = id;
|
|
8
|
+
this.data = new Discord.SlashCommandBuilder();
|
|
9
|
+
this.data.setName(options.name);
|
|
10
|
+
this.data.setNameLocalizations(options.nameLocalizations || null);
|
|
11
|
+
this.data.setDescription(options.description);
|
|
12
|
+
this.data.setDescriptionLocalizations(options.descriptionLocalizations || null);
|
|
13
|
+
this.data.setDMPermission(options.permissions?.dm || null);
|
|
14
|
+
if (options.args && options?.args?.length > 0) {
|
|
15
|
+
this.addArguments(this.data, options.args);
|
|
16
|
+
}
|
|
17
|
+
if (options.subcommands && options?.subcommands?.length > 0) {
|
|
18
|
+
this.addSubcommands(this.data, options.subcommands);
|
|
19
|
+
}
|
|
20
|
+
if (options.groups && options?.groups?.length > 0) {
|
|
21
|
+
this.addSubcommandGroups(options.groups);
|
|
22
|
+
}
|
|
23
|
+
options = z
|
|
24
|
+
.object({
|
|
25
|
+
name: z.string(),
|
|
26
|
+
description: z.string(),
|
|
27
|
+
usage: z.string().or(z.null()).default(null),
|
|
28
|
+
info: z.string().or(z.null()).default(null),
|
|
29
|
+
category: z.string().or(z.null()).default(null),
|
|
30
|
+
cooldown: z.number().or(z.null()).default(null),
|
|
31
|
+
number: z.number().or(z.null()).default(null),
|
|
32
|
+
global: z.boolean().default(true),
|
|
33
|
+
channel: z
|
|
34
|
+
.array(
|
|
35
|
+
z.enum([
|
|
36
|
+
'GuildText',
|
|
37
|
+
'DM',
|
|
38
|
+
'GuildVoice',
|
|
39
|
+
'GroupDM',
|
|
40
|
+
'GuildCategory',
|
|
41
|
+
'GuildAnnouncement',
|
|
42
|
+
'AnnouncementThread',
|
|
43
|
+
'PublicThread',
|
|
44
|
+
'PrivateThread',
|
|
45
|
+
'GuildStageVoice',
|
|
46
|
+
'GuildDirectory',
|
|
47
|
+
'GuildForum',
|
|
48
|
+
'GuildNews',
|
|
49
|
+
'GuildNewsThread',
|
|
50
|
+
'GuildPublicThread',
|
|
51
|
+
'GuildPrivateThread',
|
|
52
|
+
])
|
|
53
|
+
)
|
|
54
|
+
.or(
|
|
55
|
+
z.enum([
|
|
56
|
+
'GuildText',
|
|
57
|
+
'DM',
|
|
58
|
+
'GuildVoice',
|
|
59
|
+
'GroupDM',
|
|
60
|
+
'GuildCategory',
|
|
61
|
+
'GuildAnnouncement',
|
|
62
|
+
'AnnouncementThread',
|
|
63
|
+
'PublicThread',
|
|
64
|
+
'PrivateThread',
|
|
65
|
+
'GuildStageVoice',
|
|
66
|
+
'GuildDirectory',
|
|
67
|
+
'GuildForum',
|
|
68
|
+
'GuildNews',
|
|
69
|
+
'GuildNewsThread',
|
|
70
|
+
'GuildPublicThread',
|
|
71
|
+
'GuildPrivateThread',
|
|
72
|
+
])
|
|
73
|
+
)
|
|
74
|
+
.or(z.null())
|
|
75
|
+
.default(null),
|
|
76
|
+
ignore: z
|
|
77
|
+
.object({
|
|
78
|
+
owner: z.boolean().default(false),
|
|
79
|
+
users: z.array(z.string()).default([]),
|
|
80
|
+
channels: z.array(z.string()).default([]),
|
|
81
|
+
guilds: z.array(z.string()).default([]),
|
|
82
|
+
voice: z.boolean().default(false),
|
|
83
|
+
})
|
|
84
|
+
.default({}),
|
|
85
|
+
strict: z
|
|
86
|
+
.object({
|
|
87
|
+
owner: z.boolean().default(false),
|
|
88
|
+
users: z.array(z.string()).default([]),
|
|
89
|
+
channels: z.array(z.string()).default([]),
|
|
90
|
+
guilds: z.array(z.string()).default([]),
|
|
91
|
+
voice: z.boolean().default(false),
|
|
92
|
+
})
|
|
93
|
+
.default({}),
|
|
94
|
+
permissions: z
|
|
95
|
+
.object({
|
|
96
|
+
user: z.array(z.string()).or(z.null()).default(null),
|
|
97
|
+
client: z.array(z.string()).or(z.null()).default(null),
|
|
98
|
+
dm: z.boolean().default(true),
|
|
99
|
+
})
|
|
100
|
+
.default({}),
|
|
101
|
+
defer: z
|
|
102
|
+
.object({
|
|
103
|
+
reply: z.boolean().optional(),
|
|
104
|
+
ephemeral: z.boolean().optional(),
|
|
105
|
+
fetch: z.boolean().optional(),
|
|
106
|
+
})
|
|
107
|
+
.default({}),
|
|
108
|
+
})
|
|
109
|
+
.parse(options);
|
|
110
|
+
this.name = options.name;
|
|
111
|
+
this.description = options.description;
|
|
112
|
+
this.usage = options.usage;
|
|
113
|
+
this.info = options.info;
|
|
114
|
+
this.category = options.category;
|
|
115
|
+
this.cooldown = options.cooldown;
|
|
116
|
+
this.channel = options.channel ? (Array.isArray(options.channel) ? options.channel : [options.channel]) : null;
|
|
117
|
+
this.global = options.global;
|
|
118
|
+
this.ignore = options.ignore;
|
|
119
|
+
this.strict = options.strict;
|
|
120
|
+
this.permissions = options.permissions;
|
|
121
|
+
this.defer = options.defer;
|
|
122
|
+
this.client = this.client;
|
|
123
|
+
this.util = this.util;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* @description autocomplete let's you add choices to string option arguments
|
|
127
|
+
* @param interaction - The interaction event emitted on this command
|
|
128
|
+
* @param focused - The command option that is in focus
|
|
129
|
+
* @param options - The full list of options on the command
|
|
130
|
+
*/
|
|
131
|
+
async autocomplete(interaction, focused, options) {}
|
|
132
|
+
/**
|
|
133
|
+
* @description Checks for conditions before running the command
|
|
134
|
+
* @param interaction - The interaction event emitted on this command
|
|
135
|
+
* @param options - The args, group and subcommand parsed on this command
|
|
136
|
+
*/
|
|
137
|
+
async conditions(interaction, { args, subcommand, group }) {}
|
|
138
|
+
/**
|
|
139
|
+
* @description Runs the execution rule
|
|
140
|
+
* @param interaction - The interaction event emitted on this command
|
|
141
|
+
* @param options - The args, group and subcommand parsed on this command
|
|
142
|
+
*/
|
|
143
|
+
async exec(interaction, { args, subcommand, group }) {
|
|
144
|
+
new XernerxLog(this.client).error(`${this.id} doesn't have an execution rule.`);
|
|
145
|
+
return await this.client.emit('commandError', interaction, `${this.id} doesn't have an execution rule.`, this);
|
|
146
|
+
}
|
|
147
|
+
addArguments(command, args) {
|
|
148
|
+
for (const argument of args) {
|
|
149
|
+
let slashCommandArgumentType = `${argument.type.charAt(0).toUpperCase()}${argument.type.slice(1).toLowerCase()}`;
|
|
150
|
+
command[`add${slashCommandArgumentType}Option`]((option) => {
|
|
151
|
+
option
|
|
152
|
+
.setName(argument.name)
|
|
153
|
+
.setDescription(argument.description)
|
|
154
|
+
.setRequired(argument.required || false);
|
|
155
|
+
if (slashCommandArgumentType === 'String') {
|
|
156
|
+
if (argument.choices)
|
|
157
|
+
option.setChoices(
|
|
158
|
+
...argument.choices.map((choices) => {
|
|
159
|
+
return { name: Object.keys(choices).at(0), value: Object.values(choices).at(0) };
|
|
160
|
+
})
|
|
161
|
+
);
|
|
162
|
+
option.setAutocomplete(argument.autocomplete || false);
|
|
163
|
+
}
|
|
164
|
+
return option;
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
addSubcommands(method, subcommands) {
|
|
169
|
+
for (const subcommand of subcommands) {
|
|
170
|
+
let sub = new SlashCommandSubcommandBuilder().setName(subcommand.name).setDescription(subcommand.description);
|
|
171
|
+
if (subcommand.args && subcommand?.args?.length > 0) this.addArguments(sub, subcommand.args);
|
|
172
|
+
method.addSubcommand(sub);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
addSubcommandGroups(groups) {
|
|
176
|
+
for (const group of groups) {
|
|
177
|
+
let subcommandGroup = new SlashCommandSubcommandGroupBuilder().setName(group.name).setDescription(group.description);
|
|
178
|
+
if (group.subcommands?.length > 0) this.addSubcommands(subcommandGroup, group.subcommands);
|
|
179
|
+
this.data.addSubcommandGroup(subcommandGroup);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
178
182
|
}
|
|
@@ -7,49 +7,59 @@ import XernerxInhibitor from '../build/XernerxInhibitor.js';
|
|
|
7
7
|
import XernerxEvent from '../build/XernerxEvent.js';
|
|
8
8
|
import Cooldowns from '../models/Cooldowns.js';
|
|
9
9
|
export default class XernerxClient<T = unknown> extends Client {
|
|
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
|
-
|
|
53
|
-
|
|
54
|
-
|
|
10
|
+
readonly settings: {
|
|
11
|
+
ownerId: (string | string[]) & (string | string[] | undefined);
|
|
12
|
+
local: string;
|
|
13
|
+
ceaseless: boolean;
|
|
14
|
+
global?: boolean | undefined;
|
|
15
|
+
permissions?:
|
|
16
|
+
| {
|
|
17
|
+
user: string[] | null;
|
|
18
|
+
client: string[] | null;
|
|
19
|
+
dm: boolean;
|
|
20
|
+
}
|
|
21
|
+
| undefined;
|
|
22
|
+
ignore?:
|
|
23
|
+
| {
|
|
24
|
+
system: boolean;
|
|
25
|
+
users: string[];
|
|
26
|
+
owner: boolean;
|
|
27
|
+
self: boolean;
|
|
28
|
+
bots: boolean;
|
|
29
|
+
channels: string[];
|
|
30
|
+
guilds: string[];
|
|
31
|
+
}
|
|
32
|
+
| undefined;
|
|
33
|
+
log?:
|
|
34
|
+
| boolean
|
|
35
|
+
| {
|
|
36
|
+
warn: boolean;
|
|
37
|
+
error: boolean;
|
|
38
|
+
ready: boolean;
|
|
39
|
+
info: boolean;
|
|
40
|
+
table: string[] | null;
|
|
41
|
+
format: string[] | null;
|
|
42
|
+
}
|
|
43
|
+
| undefined;
|
|
44
|
+
cooldown?:
|
|
45
|
+
| {
|
|
46
|
+
command: number;
|
|
47
|
+
cache: number;
|
|
48
|
+
collections: string[];
|
|
49
|
+
}
|
|
50
|
+
| undefined;
|
|
51
|
+
};
|
|
52
|
+
readonly config: T;
|
|
53
|
+
readonly commands: XernerxCommands;
|
|
54
|
+
readonly events: Collection<string, XernerxEvent<keyof XernerxClientEvents>>;
|
|
55
|
+
readonly inhibitors: Collection<string, XernerxInhibitor>;
|
|
56
|
+
readonly modules: ModuleOptions;
|
|
57
|
+
readonly util: ClientUtil;
|
|
58
|
+
readonly stats: Record<string, number>;
|
|
59
|
+
readonly cache: XernerxCache;
|
|
60
|
+
readonly cooldowns: Cooldowns;
|
|
61
|
+
readonly dbl: any;
|
|
62
|
+
readonly [index: string]: unknown;
|
|
63
|
+
constructor(discordOptions: ClientOptions, xernerxOptions: XernerxOptions, config?: T);
|
|
64
|
+
connect(token: string): Promise<string>;
|
|
55
65
|
}
|
|
@@ -11,92 +11,87 @@ import ExtensionHandler from '../handlers/ExtensionHandler.js';
|
|
|
11
11
|
import deploy from '../functions/deploy.js';
|
|
12
12
|
import Cooldowns from '../models/Cooldowns.js';
|
|
13
13
|
export default class XernerxClient extends Client {
|
|
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
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
new XernerxLog(this).ready();
|
|
100
|
-
return login;
|
|
101
|
-
}
|
|
14
|
+
constructor(discordOptions, xernerxOptions, config) {
|
|
15
|
+
super(discordOptions);
|
|
16
|
+
this.settings = z
|
|
17
|
+
.object({
|
|
18
|
+
local: z.string(),
|
|
19
|
+
global: z.boolean().default(false).optional(),
|
|
20
|
+
ownerId: z.string().or(z.array(z.string())).default([]),
|
|
21
|
+
ceaseless: z.boolean().default(false),
|
|
22
|
+
permissions: z
|
|
23
|
+
.object({
|
|
24
|
+
client: z.array(z.string()).or(z.null()).default(null),
|
|
25
|
+
user: z.array(z.string()).or(z.null()).default(null),
|
|
26
|
+
dm: z.boolean().default(false),
|
|
27
|
+
})
|
|
28
|
+
.optional(),
|
|
29
|
+
ignore: z
|
|
30
|
+
.object({
|
|
31
|
+
owner: z.boolean().default(false),
|
|
32
|
+
self: z.boolean().default(true),
|
|
33
|
+
bots: z.boolean().default(true),
|
|
34
|
+
system: z.boolean().default(true),
|
|
35
|
+
users: z.array(z.string()).default([]),
|
|
36
|
+
channels: z.array(z.string()).default([]),
|
|
37
|
+
guilds: z.array(z.string()).default([]),
|
|
38
|
+
})
|
|
39
|
+
.optional(),
|
|
40
|
+
log: z
|
|
41
|
+
.object({
|
|
42
|
+
ready: z.boolean().default(false),
|
|
43
|
+
info: z.boolean().default(false),
|
|
44
|
+
warn: z.boolean().default(false),
|
|
45
|
+
error: z.boolean().default(false),
|
|
46
|
+
table: z.array(z.string()).or(z.null()).default(null),
|
|
47
|
+
format: z.array(z.string()).or(z.null()).default(null),
|
|
48
|
+
})
|
|
49
|
+
.or(z.boolean())
|
|
50
|
+
.optional(),
|
|
51
|
+
cooldown: z
|
|
52
|
+
.object({
|
|
53
|
+
command: z.number().default(0),
|
|
54
|
+
cache: z.number().default(0),
|
|
55
|
+
collections: z.array(z.string()).default(['commands']),
|
|
56
|
+
})
|
|
57
|
+
.optional(),
|
|
58
|
+
})
|
|
59
|
+
.parse(xernerxOptions);
|
|
60
|
+
this.config = config;
|
|
61
|
+
this.commands = {
|
|
62
|
+
message: new Collection(),
|
|
63
|
+
slash: new Collection(),
|
|
64
|
+
context: new Collection(),
|
|
65
|
+
};
|
|
66
|
+
this.events = new Collection();
|
|
67
|
+
this.inhibitors = new Collection();
|
|
68
|
+
this.util = new ClientUtil(this);
|
|
69
|
+
this.stats = {
|
|
70
|
+
guildCount: this.guilds.cache.size,
|
|
71
|
+
userCount: 0,
|
|
72
|
+
shardId: 0,
|
|
73
|
+
shardCount: this.options.shardCount || 1,
|
|
74
|
+
voteCount: 0,
|
|
75
|
+
};
|
|
76
|
+
this.dbl = {};
|
|
77
|
+
this.cache = {
|
|
78
|
+
messages: new Collection(),
|
|
79
|
+
cooldowns: new Collection(),
|
|
80
|
+
};
|
|
81
|
+
this.cooldowns = new Cooldowns(this, xernerxOptions.cooldown?.collections);
|
|
82
|
+
this.modules = {
|
|
83
|
+
options: {},
|
|
84
|
+
commandHandler: new CommandHandler(this),
|
|
85
|
+
eventHandler: new EventHandler(this),
|
|
86
|
+
inhibitorHandler: new InhibitorHandler(this),
|
|
87
|
+
integrationHandler: new IntegrationHandler(this),
|
|
88
|
+
extensionHandler: new ExtensionHandler(this),
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
async connect(token) {
|
|
92
|
+
const login = this.login(token); // TODO add thing to catch and have better error message
|
|
93
|
+
deploy(this);
|
|
94
|
+
new XernerxLog(this).ready();
|
|
95
|
+
return login;
|
|
96
|
+
}
|
|
102
97
|
}
|