reciple 6.0.0-dev.19 → 6.0.0-dev.20

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.
Files changed (46) hide show
  1. package/LICENSE +674 -674
  2. package/README.md +183 -183
  3. package/dist/lib/bin.mjs +65 -65
  4. package/dist/lib/esm.mjs +1 -1
  5. package/dist/lib/index.js +35 -35
  6. package/dist/lib/reciple/classes/RecipleClient.js +296 -296
  7. package/dist/lib/reciple/classes/RecipleConfig.js +106 -106
  8. package/dist/lib/reciple/classes/RecipleModule.js +94 -94
  9. package/dist/lib/reciple/classes/builders/MessageCommandBuilder.js +242 -242
  10. package/dist/lib/reciple/classes/builders/MessageCommandOptionBuilder.js +85 -85
  11. package/dist/lib/reciple/classes/builders/SlashCommandBuilder.js +216 -216
  12. package/dist/lib/reciple/classes/managers/ApplicationCommandManager.js +178 -172
  13. package/dist/lib/reciple/classes/managers/CommandCooldownManager.js +100 -100
  14. package/dist/lib/reciple/classes/managers/{ClientCommandManager.js → CommandManager.js} +59 -62
  15. package/dist/lib/reciple/classes/managers/MessageCommandOptionManager.js +25 -25
  16. package/dist/lib/reciple/classes/managers/{ClientModuleManager.js → ModuleManager.js} +179 -183
  17. package/dist/lib/reciple/flags.js +31 -31
  18. package/dist/lib/reciple/permissions.js +30 -30
  19. package/dist/lib/reciple/types/builders.js +11 -11
  20. package/dist/lib/reciple/types/commands.js +15 -15
  21. package/dist/lib/reciple/types/paramOptions.js +2 -2
  22. package/dist/lib/reciple/util.js +68 -68
  23. package/dist/lib/reciple/version.js +47 -47
  24. package/dist/types/bin.d.mts +2 -2
  25. package/dist/types/esm.d.mts +1 -1
  26. package/dist/types/index.d.ts +19 -19
  27. package/dist/types/reciple/classes/RecipleClient.d.ts +103 -103
  28. package/dist/types/reciple/classes/RecipleConfig.d.ts +100 -100
  29. package/dist/types/reciple/classes/RecipleModule.d.ts +56 -56
  30. package/dist/types/reciple/classes/builders/MessageCommandBuilder.d.ts +150 -150
  31. package/dist/types/reciple/classes/builders/MessageCommandOptionBuilder.d.ts +43 -43
  32. package/dist/types/reciple/classes/builders/SlashCommandBuilder.d.ts +88 -88
  33. package/dist/types/reciple/classes/managers/ApplicationCommandManager.d.ts +53 -51
  34. package/dist/types/reciple/classes/managers/CommandCooldownManager.d.ts +70 -70
  35. package/dist/types/reciple/classes/managers/{ClientCommandManager.d.ts → CommandManager.d.ts} +36 -37
  36. package/dist/types/reciple/classes/managers/MessageCommandOptionManager.d.ts +22 -22
  37. package/dist/types/reciple/classes/managers/{ClientModuleManager.d.ts → ModuleManager.d.ts} +49 -49
  38. package/dist/types/reciple/flags.d.ts +17 -17
  39. package/dist/types/reciple/permissions.d.ts +19 -19
  40. package/dist/types/reciple/types/builders.d.ts +197 -197
  41. package/dist/types/reciple/types/commands.d.ts +81 -81
  42. package/dist/types/reciple/types/paramOptions.d.ts +101 -101
  43. package/dist/types/reciple/util.d.ts +23 -23
  44. package/dist/types/reciple/version.d.ts +25 -25
  45. package/package.json +1 -1
  46. package/resource/reciple.yml +120 -120
@@ -1,172 +1,178 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ApplicationCommandManager = void 0;
4
- const discord_js_1 = require("discord.js");
5
- const SlashCommandBuilder_1 = require("../builders/SlashCommandBuilder");
6
- class ApplicationCommandManager {
7
- constructor(client) {
8
- this.client = client;
9
- }
10
- /**
11
- * Sets application commands globally or in guilds
12
- * @param commands Application commands
13
- * @param guilds set only to guilds
14
- */
15
- async set(commands, ...guilds) {
16
- guilds = (0, discord_js_1.normalizeArray)(guilds);
17
- if (!this.client.isReady())
18
- throw new Error('Client is not ready');
19
- if (guilds && guilds.length > 1) {
20
- for (const guild of guilds) {
21
- await this.set(commands, guild);
22
- }
23
- return;
24
- }
25
- let guild = guilds?.shift();
26
- guild = guild ? this.client.guilds.resolveId(guild) || undefined : undefined;
27
- if (!guild) {
28
- await this.client.application.commands.set(commands);
29
- if (!this.client.isClientLogsSilent)
30
- this.client.logger.log(`Registered ${this.client.commands.applicationCommandsSize} application command(s) globally...`);
31
- }
32
- else {
33
- await this.client.application.commands.set(commands, guild);
34
- if (!this.client.isClientLogsSilent)
35
- this.client.logger.log(`Registered ${this.client.commands.applicationCommandsSize} application command(s) to guild ${guild}`);
36
- }
37
- }
38
- /**
39
- * Add command globally or in guilds
40
- * @param command Application command
41
- * @param guilds add only in guilds
42
- */
43
- async add(command, ...guilds) {
44
- guilds = (0, discord_js_1.normalizeArray)(guilds);
45
- if (!this.client.isReady())
46
- throw new Error('Client is not ready');
47
- if (!command)
48
- throw new Error('Command is undefined');
49
- if (guilds && guilds.length > 1) {
50
- for (const guild of guilds) {
51
- await this.add(command, guild);
52
- }
53
- return;
54
- }
55
- let guild = guilds?.shift();
56
- guild = guild ? this.client.guilds.resolveId(guild) || undefined : undefined;
57
- if (!guild) {
58
- await this.client.application.commands.create(command);
59
- if (!this.client.isClientLogsSilent)
60
- this.client.logger.log(`Created application command '${command.name}' globally`);
61
- }
62
- else {
63
- await this.client.application.commands.create(command, guild);
64
- if (!this.client.isClientLogsSilent)
65
- this.client.logger.log(`Created application command '${command.name}' to guild ${guild}`);
66
- }
67
- }
68
- /**
69
- * Remove application command globally or in guilds
70
- * @param command id of application commmand or ApplicationCommand class
71
- * @param guilds Remove from guilds
72
- */
73
- async remove(command, ...guilds) {
74
- guilds = (0, discord_js_1.normalizeArray)(guilds);
75
- if (!this.client.isReady())
76
- throw new Error('Client is not ready');
77
- if (!command)
78
- throw new Error('Command is undefined');
79
- if (guilds && guilds.length > 1) {
80
- for (const guild of guilds) {
81
- await this.remove(command, guild);
82
- }
83
- return;
84
- }
85
- let guild = guilds?.shift();
86
- guild = guild ? this.client.guilds.resolveId(guild) || undefined : undefined;
87
- if (!guild) {
88
- await this.client.application.commands.delete(command);
89
- if (!this.client.isClientLogsSilent)
90
- this.client.logger.log(`Removed application command '${typeof command === 'string' ? command : command.name}' globally`);
91
- }
92
- else {
93
- await this.client.application.commands.delete(command, guild);
94
- if (!this.client.isClientLogsSilent)
95
- this.client.logger.log(`Removed application command '${typeof command === 'string' ? command : command.name}' from guild ${guild}`);
96
- }
97
- }
98
- /**
99
- * Edit application command globally or in guilds
100
- * @param command id of application command or ApplicationCommand class
101
- * @param newCommand new application command data
102
- * @param guilds Edit only from guilds
103
- */
104
- async edit(command, newCommand, ...guilds) {
105
- guilds = (0, discord_js_1.normalizeArray)(guilds);
106
- if (!this.client.isReady())
107
- throw new Error('Client is not ready');
108
- if (!command)
109
- throw new Error('Command is undefined');
110
- if (guilds && guilds.length > 1) {
111
- for (const guild of guilds) {
112
- await this.edit(command, newCommand, guild);
113
- }
114
- return;
115
- }
116
- let guild = guilds?.shift();
117
- guild = guild ? this.client.guilds.resolveId(guild) || undefined : undefined;
118
- if (!guild) {
119
- await this.client.application.commands.edit(command, newCommand);
120
- if (!this.client.isClientLogsSilent)
121
- this.client.logger.log(`Removed application command '${typeof command === 'string' ? command : command.name}' globally`);
122
- }
123
- else {
124
- await this.client.application.commands.edit(command, newCommand, guild);
125
- if (!this.client.isClientLogsSilent)
126
- this.client.logger.log(`Removed application command '${typeof command === 'string' ? command : command.name}' from guild ${guild}`);
127
- }
128
- }
129
- /**
130
- * Get application command from cache by application command data, builder, id, or name globally or from guid
131
- * @param command application command data, builder, id, or name
132
- * @param guild get command from guild
133
- */
134
- get(command, guild) {
135
- const commands = guild ? this.client.guilds.resolve(guild)?.commands.cache : this.client.application?.commands.cache;
136
- if (!commands)
137
- throw new Error('Guild not found in cache');
138
- return commands.find(cmd => (typeof command === 'string' ? cmd.id === command || cmd.name === command : cmd.name === command.name || (command instanceof discord_js_1.ApplicationCommand && cmd.id === command.id)));
139
- }
140
- /**
141
- * Fetch application command by id globally or from guild
142
- * @param commandId command id
143
- * @param guild fetch from guild
144
- */
145
- async fetch(commandId, guild) {
146
- const manager = guild ? this.client.guilds.resolve(guild)?.commands : this.client.application?.commands;
147
- if (!manager)
148
- throw new Error('Guild not found in cache');
149
- return manager.fetch(commandId);
150
- }
151
- /**
152
- * Parse application command builders to command data
153
- * @param commands Application command builders
154
- * @param setPermissions set slash commands permissions
155
- */
156
- parseCommands(commands, setPermissions = true) {
157
- return commands.map(cmd => {
158
- if (cmd?.toJSON === undefined)
159
- return cmd;
160
- if (SlashCommandBuilder_1.SlashCommandBuilder.isSlashCommandBuilder(cmd) && this.client.config.commands.slashCommand.setRequiredPermissions) {
161
- const permissions = setPermissions || this.client.config.commands.slashCommand.permissions.enabled ? this.client.config.commands.slashCommand.permissions.commands.find(cmd_ => cmd_.command.toLowerCase() === cmd.name.toLowerCase())?.permissions : undefined;
162
- if (permissions) {
163
- cmd.setRequiredMemberPermissions(...permissions);
164
- if (!this.client.isClientLogsSilent)
165
- this.client.logger.debug(`Set required permissions for ${cmd.name}`);
166
- }
167
- }
168
- return cmd.toJSON();
169
- });
170
- }
171
- }
172
- exports.ApplicationCommandManager = ApplicationCommandManager;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ApplicationCommandManager = void 0;
4
+ const discord_js_1 = require("discord.js");
5
+ const SlashCommandBuilder_1 = require("../builders/SlashCommandBuilder");
6
+ class ApplicationCommandManager {
7
+ constructor(client) {
8
+ this.client = client;
9
+ }
10
+ get commands() {
11
+ return [...this.client.commands.additionalApplicationCommands, ...this.client.commands.slashCommands.toJSON()];
12
+ }
13
+ get size() {
14
+ return this.commands.length;
15
+ }
16
+ /**
17
+ * Sets application commands globally or in guilds
18
+ * @param commands Application commands
19
+ * @param guilds set only to guilds
20
+ */
21
+ async set(commands, ...guilds) {
22
+ guilds = (0, discord_js_1.normalizeArray)(guilds);
23
+ if (!this.client.isReady())
24
+ throw new Error('Client is not ready');
25
+ if (guilds && guilds.length > 1) {
26
+ for (const guild of guilds) {
27
+ await this.set(commands, guild);
28
+ }
29
+ return;
30
+ }
31
+ let guild = guilds?.shift();
32
+ guild = guild ? this.client.guilds.resolveId(guild) || undefined : undefined;
33
+ if (!guild) {
34
+ await this.client.application.commands.set(commands);
35
+ if (!this.client.isClientLogsSilent)
36
+ this.client.logger.log(`Registered ${this.client.applicationCommands.size} application command(s) globally...`);
37
+ }
38
+ else {
39
+ await this.client.application.commands.set(commands, guild);
40
+ if (!this.client.isClientLogsSilent)
41
+ this.client.logger.log(`Registered ${this.client.applicationCommands.size} application command(s) to guild ${guild}`);
42
+ }
43
+ }
44
+ /**
45
+ * Add command globally or in guilds
46
+ * @param command Application command
47
+ * @param guilds add only in guilds
48
+ */
49
+ async add(command, ...guilds) {
50
+ guilds = (0, discord_js_1.normalizeArray)(guilds);
51
+ if (!this.client.isReady())
52
+ throw new Error('Client is not ready');
53
+ if (!command)
54
+ throw new Error('Command is undefined');
55
+ if (guilds && guilds.length > 1) {
56
+ for (const guild of guilds) {
57
+ await this.add(command, guild);
58
+ }
59
+ return;
60
+ }
61
+ let guild = guilds?.shift();
62
+ guild = guild ? this.client.guilds.resolveId(guild) || undefined : undefined;
63
+ if (!guild) {
64
+ await this.client.application.commands.create(command);
65
+ if (!this.client.isClientLogsSilent)
66
+ this.client.logger.log(`Created application command '${command.name}' globally`);
67
+ }
68
+ else {
69
+ await this.client.application.commands.create(command, guild);
70
+ if (!this.client.isClientLogsSilent)
71
+ this.client.logger.log(`Created application command '${command.name}' to guild ${guild}`);
72
+ }
73
+ }
74
+ /**
75
+ * Remove application command globally or in guilds
76
+ * @param command id of application commmand or ApplicationCommand class
77
+ * @param guilds Remove from guilds
78
+ */
79
+ async remove(command, ...guilds) {
80
+ guilds = (0, discord_js_1.normalizeArray)(guilds);
81
+ if (!this.client.isReady())
82
+ throw new Error('Client is not ready');
83
+ if (!command)
84
+ throw new Error('Command is undefined');
85
+ if (guilds && guilds.length > 1) {
86
+ for (const guild of guilds) {
87
+ await this.remove(command, guild);
88
+ }
89
+ return;
90
+ }
91
+ let guild = guilds?.shift();
92
+ guild = guild ? this.client.guilds.resolveId(guild) || undefined : undefined;
93
+ if (!guild) {
94
+ await this.client.application.commands.delete(command);
95
+ if (!this.client.isClientLogsSilent)
96
+ this.client.logger.log(`Removed application command '${typeof command === 'string' ? command : command.name}' globally`);
97
+ }
98
+ else {
99
+ await this.client.application.commands.delete(command, guild);
100
+ if (!this.client.isClientLogsSilent)
101
+ this.client.logger.log(`Removed application command '${typeof command === 'string' ? command : command.name}' from guild ${guild}`);
102
+ }
103
+ }
104
+ /**
105
+ * Edit application command globally or in guilds
106
+ * @param command id of application command or ApplicationCommand class
107
+ * @param newCommand new application command data
108
+ * @param guilds Edit only from guilds
109
+ */
110
+ async edit(command, newCommand, ...guilds) {
111
+ guilds = (0, discord_js_1.normalizeArray)(guilds);
112
+ if (!this.client.isReady())
113
+ throw new Error('Client is not ready');
114
+ if (!command)
115
+ throw new Error('Command is undefined');
116
+ if (guilds && guilds.length > 1) {
117
+ for (const guild of guilds) {
118
+ await this.edit(command, newCommand, guild);
119
+ }
120
+ return;
121
+ }
122
+ let guild = guilds?.shift();
123
+ guild = guild ? this.client.guilds.resolveId(guild) || undefined : undefined;
124
+ if (!guild) {
125
+ await this.client.application.commands.edit(command, newCommand);
126
+ if (!this.client.isClientLogsSilent)
127
+ this.client.logger.log(`Removed application command '${typeof command === 'string' ? command : command.name}' globally`);
128
+ }
129
+ else {
130
+ await this.client.application.commands.edit(command, newCommand, guild);
131
+ if (!this.client.isClientLogsSilent)
132
+ this.client.logger.log(`Removed application command '${typeof command === 'string' ? command : command.name}' from guild ${guild}`);
133
+ }
134
+ }
135
+ /**
136
+ * Get application command from cache by application command data, builder, id, or name globally or from guid
137
+ * @param command application command data, builder, id, or name
138
+ * @param guild get command from guild
139
+ */
140
+ get(command, guild) {
141
+ const commands = guild ? this.client.guilds.resolve(guild)?.commands.cache : this.client.application?.commands.cache;
142
+ if (!commands)
143
+ throw new Error('Guild not found in cache');
144
+ return commands.find(cmd => (typeof command === 'string' ? cmd.id === command || cmd.name === command : cmd.name === command.name || (command instanceof discord_js_1.ApplicationCommand && cmd.id === command.id)));
145
+ }
146
+ /**
147
+ * Fetch application command by id globally or from guild
148
+ * @param commandId command id
149
+ * @param guild fetch from guild
150
+ */
151
+ async fetch(commandId, guild) {
152
+ const manager = guild ? this.client.guilds.resolve(guild)?.commands : this.client.application?.commands;
153
+ if (!manager)
154
+ throw new Error('Guild not found in cache');
155
+ return manager.fetch(commandId);
156
+ }
157
+ /**
158
+ * Parse application command builders to command data
159
+ * @param commands Application command builders
160
+ * @param setPermissions set slash commands permissions
161
+ */
162
+ parseCommands(commands, setPermissions = true) {
163
+ return commands.map(cmd => {
164
+ if (cmd?.toJSON === undefined)
165
+ return cmd;
166
+ if (SlashCommandBuilder_1.SlashCommandBuilder.isSlashCommandBuilder(cmd) && this.client.config.commands.slashCommand.setRequiredPermissions) {
167
+ const permissions = setPermissions || this.client.config.commands.slashCommand.permissions.enabled ? this.client.config.commands.slashCommand.permissions.commands.find(cmd_ => cmd_.command.toLowerCase() === cmd.name.toLowerCase())?.permissions : undefined;
168
+ if (permissions) {
169
+ cmd.setRequiredMemberPermissions(...permissions);
170
+ if (!this.client.isClientLogsSilent)
171
+ this.client.logger.debug(`Set required permissions for ${cmd.name}`);
172
+ }
173
+ }
174
+ return cmd.toJSON();
175
+ });
176
+ }
177
+ }
178
+ exports.ApplicationCommandManager = ApplicationCommandManager;
@@ -1,100 +1,100 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CommandCooldownManager = void 0;
4
- const discord_js_1 = require("discord.js");
5
- /**
6
- * cooled-down users manager
7
- */
8
- class CommandCooldownManager extends Array {
9
- constructor(...data) {
10
- super(...(0, discord_js_1.normalizeArray)(data));
11
- }
12
- /**
13
- * Alias for `CommandCooldownManager#push()`
14
- * @param options Cooled-down user data
15
- */
16
- add(...options) {
17
- return this.push(...options);
18
- }
19
- /**
20
- * Remove cooldown from specific user, channel or guild
21
- * @param options Remove cooldown data options
22
- * @param limit Remove cooldown data limit
23
- * @returns Returns the removed values
24
- */
25
- remove(options, limit = 0) {
26
- if (!Object.keys(options).length)
27
- throw new TypeError('Provide atleast one option to remove cooldown data.');
28
- const removed = [];
29
- let i = 0;
30
- for (let i = 0; i < this.length; i++) {
31
- if (!CommandCooldownManager.checkOptions(options, this[i]))
32
- continue;
33
- if (options.expireTime && this[i].expireTime > Date.now())
34
- continue;
35
- if (limit && i >= limit)
36
- continue;
37
- removed.push(this[i]);
38
- this.splice(Number(i));
39
- }
40
- return removed;
41
- }
42
- /**
43
- * Check if the given user is cooled-down
44
- * @param options Options to identify if user is on cooldown
45
- */
46
- isCooledDown(options) {
47
- const data = this.get(options);
48
- if (!data)
49
- return false;
50
- this.remove({
51
- ...data,
52
- channel: undefined,
53
- guild: undefined,
54
- type: undefined,
55
- command: undefined,
56
- });
57
- if (data.expireTime < Date.now())
58
- return false;
59
- return true;
60
- }
61
- /**
62
- * Purge non cooled-down users from this array
63
- * @param options Clean cooldown options
64
- */
65
- clean(options) {
66
- for (const index in this) {
67
- if (options && !CommandCooldownManager.checkOptions(options, this[index]))
68
- return;
69
- if (this[index].expireTime > Date.now())
70
- return;
71
- this.slice(Number(index));
72
- }
73
- }
74
- /**
75
- * Get someone's cooldown data
76
- * @param options Get cooldown data options
77
- */
78
- get(options) {
79
- return this.find(data => CommandCooldownManager.checkOptions(options, data));
80
- }
81
- /**
82
- * Check if the options are valid
83
- * @param options Options to validated
84
- * @param data Cooled-down user data
85
- */
86
- static checkOptions(options, data) {
87
- if (options?.user !== undefined && options.user.id !== data.user.id)
88
- return false;
89
- if (options?.guild !== undefined && options.guild?.id !== data.guild?.id)
90
- return false;
91
- if (options?.channel !== undefined && options.channel.id !== data.channel?.id)
92
- return false;
93
- if (options?.command !== undefined && options.command !== data.command)
94
- return false;
95
- if (options?.type !== undefined && options.type !== data.type)
96
- return false;
97
- return true;
98
- }
99
- }
100
- exports.CommandCooldownManager = CommandCooldownManager;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CommandCooldownManager = void 0;
4
+ const discord_js_1 = require("discord.js");
5
+ /**
6
+ * cooled-down users manager
7
+ */
8
+ class CommandCooldownManager extends Array {
9
+ constructor(...data) {
10
+ super(...(0, discord_js_1.normalizeArray)(data));
11
+ }
12
+ /**
13
+ * Alias for `CommandCooldownManager#push()`
14
+ * @param options Cooled-down user data
15
+ */
16
+ add(...options) {
17
+ return this.push(...options);
18
+ }
19
+ /**
20
+ * Remove cooldown from specific user, channel or guild
21
+ * @param options Remove cooldown data options
22
+ * @param limit Remove cooldown data limit
23
+ * @returns Returns the removed values
24
+ */
25
+ remove(options, limit = 0) {
26
+ if (!Object.keys(options).length)
27
+ throw new TypeError('Provide atleast one option to remove cooldown data.');
28
+ const removed = [];
29
+ let i = 0;
30
+ for (let i = 0; i < this.length; i++) {
31
+ if (!CommandCooldownManager.checkOptions(options, this[i]))
32
+ continue;
33
+ if (options.expireTime && this[i].expireTime > Date.now())
34
+ continue;
35
+ if (limit && i >= limit)
36
+ continue;
37
+ removed.push(this[i]);
38
+ this.splice(Number(i));
39
+ }
40
+ return removed;
41
+ }
42
+ /**
43
+ * Check if the given user is cooled-down
44
+ * @param options Options to identify if user is on cooldown
45
+ */
46
+ isCooledDown(options) {
47
+ const data = this.get(options);
48
+ if (!data)
49
+ return false;
50
+ this.remove({
51
+ ...data,
52
+ channel: undefined,
53
+ guild: undefined,
54
+ type: undefined,
55
+ command: undefined,
56
+ });
57
+ if (data.expireTime < Date.now())
58
+ return false;
59
+ return true;
60
+ }
61
+ /**
62
+ * Purge non cooled-down users from this array
63
+ * @param options Clean cooldown options
64
+ */
65
+ clean(options) {
66
+ for (const index in this) {
67
+ if (options && !CommandCooldownManager.checkOptions(options, this[index]))
68
+ return;
69
+ if (this[index].expireTime > Date.now())
70
+ return;
71
+ this.slice(Number(index));
72
+ }
73
+ }
74
+ /**
75
+ * Get someone's cooldown data
76
+ * @param options Get cooldown data options
77
+ */
78
+ get(options) {
79
+ return this.find(data => CommandCooldownManager.checkOptions(options, data));
80
+ }
81
+ /**
82
+ * Check if the options are valid
83
+ * @param options Options to validated
84
+ * @param data Cooled-down user data
85
+ */
86
+ static checkOptions(options, data) {
87
+ if (options?.user !== undefined && options.user.id !== data.user.id)
88
+ return false;
89
+ if (options?.guild !== undefined && options.guild?.id !== data.guild?.id)
90
+ return false;
91
+ if (options?.channel !== undefined && options.channel.id !== data.channel?.id)
92
+ return false;
93
+ if (options?.command !== undefined && options.command !== data.command)
94
+ return false;
95
+ if (options?.type !== undefined && options.type !== data.type)
96
+ return false;
97
+ return true;
98
+ }
99
+ }
100
+ exports.CommandCooldownManager = CommandCooldownManager;