reciple 6.0.0 → 6.0.3

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 (29) hide show
  1. package/LICENSE +674 -674
  2. package/README.md +182 -182
  3. package/dist/lib/bin.mjs +8 -1
  4. package/dist/lib/bin.mjs.map +1 -1
  5. package/dist/lib/reciple/classes/RecipleClient.js +79 -94
  6. package/dist/lib/reciple/classes/RecipleClient.js.map +1 -1
  7. package/dist/lib/reciple/classes/RecipleConfig.js.map +1 -1
  8. package/dist/lib/reciple/classes/RecipleModule.js +1 -1
  9. package/dist/lib/reciple/classes/RecipleModule.js.map +1 -1
  10. package/dist/lib/reciple/classes/builders/MessageCommandBuilder.js +7 -1
  11. package/dist/lib/reciple/classes/builders/MessageCommandBuilder.js.map +1 -1
  12. package/dist/lib/reciple/classes/builders/MessageCommandOptionBuilder.js.map +1 -1
  13. package/dist/lib/reciple/classes/builders/SlashCommandBuilder.js +7 -1
  14. package/dist/lib/reciple/classes/builders/SlashCommandBuilder.js.map +1 -1
  15. package/dist/lib/reciple/types/commands.js.map +1 -1
  16. package/dist/types/reciple/classes/RecipleClient.d.ts +1 -0
  17. package/dist/types/reciple/classes/RecipleClient.d.ts.map +1 -1
  18. package/dist/types/reciple/classes/RecipleConfig.d.ts +1 -0
  19. package/dist/types/reciple/classes/RecipleConfig.d.ts.map +1 -1
  20. package/dist/types/reciple/classes/builders/MessageCommandBuilder.d.ts +8 -0
  21. package/dist/types/reciple/classes/builders/MessageCommandBuilder.d.ts.map +1 -1
  22. package/dist/types/reciple/classes/builders/MessageCommandOptionBuilder.d.ts +1 -1
  23. package/dist/types/reciple/classes/builders/MessageCommandOptionBuilder.d.ts.map +1 -1
  24. package/dist/types/reciple/classes/builders/SlashCommandBuilder.d.ts +8 -0
  25. package/dist/types/reciple/classes/builders/SlashCommandBuilder.d.ts.map +1 -1
  26. package/dist/types/reciple/types/commands.d.ts +4 -0
  27. package/dist/types/reciple/types/commands.d.ts.map +1 -1
  28. package/package.json +2 -2
  29. package/resource/reciple.yml +2 -0
package/README.md CHANGED
@@ -1,182 +1,182 @@
1
- <h1 align="center">
2
- <img src="https://i.imgur.com/DWM0tJL.png" width="50%">
3
- <br>
4
- </h1>
5
-
6
- <h3 align="center">
7
- <a href="https://npmjs.org/package/reciple">
8
- <img src="https://img.shields.io/npm/v/reciple?label=latest%20npm%20release%20">
9
- </a>
10
- <a href="https://github.com/FalloutStudios/Reciple/blob/main/LICENSE">
11
- <img src="https://img.shields.io/github/license/FalloutStudios/Reciple">
12
- </a>
13
- <a href="https://www.codefactor.io/repository/github/falloutstudios/reciple/overview/main">
14
- <img src="https://www.codefactor.io/repository/github/falloutstudios/reciple/badge/main">
15
- </a>
16
-
17
- A simple Dicord.js handler that just works.
18
- </h3>
19
-
20
- ***
21
-
22
- <p align="center">
23
- <a href="https://discord.gg/2CattJYNpw" title="">
24
- <img src="https://i.imgur.com/GffJByO.png" alt="Join Discord">
25
- </a>
26
- </p>
27
-
28
- # Features
29
-
30
- * [CLI based handler](#command-line)
31
- * [Message command builder](#messagecommandbuilder-example)
32
- * [Built-in message command validation](#built-in-message-command-validation)
33
- * Automatically register application commands
34
- * [Built-in command cooldowns](#command-cooldowns)
35
- * [Highly configurable](#config)
36
-
37
- ## Installation
38
-
39
- To install the bot, run the following command in your terminal:
40
-
41
- ```bash
42
- npm i reciple discord.js
43
- ```
44
-
45
- You can initialize the bot to the current directory with the following command in your terminal:
46
-
47
- ```bash
48
- npx reciple
49
- ```
50
-
51
- It will ask you to continue if the directory is not empty. Type `y` to continue. After the bot has been initialized, it will ask you for your bot token.
52
-
53
- > You can change the token anytime you want
54
-
55
- ## Config
56
-
57
- You can configure the bot in `reciple.yml` located in the bot's root directory.
58
-
59
- ### Token
60
-
61
- You can directly change the token in `reciple.yml`.
62
-
63
- ```yml
64
- token: "YOUR_TOKEN_HERE"
65
- ```
66
-
67
- Using environment variables is also supported.
68
-
69
- ```yml
70
- token: "env:TOKEN_VARIABLE"
71
- ```
72
-
73
- You can override the given token using your terminal
74
-
75
- ```bash
76
- npx reciple --token "YOUR_TOKEN_HERE"
77
- ```
78
-
79
- Use env variable
80
-
81
- ```bash
82
- npx reciple --token "env:TOKEN_VARIABLE"
83
- ```
84
-
85
- ## Starting the bot
86
- To start the bot, run the following command:
87
-
88
- ```bash
89
- npx reciple
90
- ```
91
-
92
- ## Command line
93
-
94
- **Usage:** `reciple [options] [current-working-directory]`
95
-
96
- **Arguments:**
97
- * `current-working-directory` Change the current working directory
98
-
99
- **Options:**
100
- * `-v, --version` output the version number
101
- * `-t, --token <token>` Replace used bot token
102
- * `-c, --config <config>` Change path to config file
103
- * `-D, --debugmode` Enable debug mode
104
- * `-y, --yes` Automatically agree to Reciple confirmation prompts
105
- * `-h, --help` display help for command
106
-
107
- ## MessageCommandBuilder Example
108
-
109
- * Read docs for [MessageCommandBuilder](https://reciple.js.org/#/docs/reciple.js/main/class/MessageCommandBuilder)
110
-
111
- ```js
112
- new MessageCommandBuilder()
113
- .setName("command")
114
- .setDescription("Your lil tiny description")
115
- .addAliases('cmd', 'cmd1')
116
- .setExecute(command => command.message.reply("Hello!"))
117
- ```
118
-
119
- ## Built-in message command validation
120
-
121
- * Read docs for [MessageCommandBuilder#setValidateOptions()](https://reciple.js.org/#/docs/reciple.js/main/class/MessageCommandBuilder?scrollTo=setValidateOptions), [MessageCommandOptionBuilder](https://reciple.js.org/#/docs/reciple.js/main/class/MessageCommandOptionBuilder), [MessageCommandOptionManager](https://reciple.js.org/#/docs/reciple.js/main/class/MessageCommandOptionManager)
122
- ```js
123
- new MessageCommandBuilder()
124
- .setName("command")
125
- .setDescription("Your lil tiny description")
126
- .addAliases('cmd', 'cmd1')
127
- .setValidateOptions(true) // Validate options
128
- .addOption(option => option
129
- .setName("quantity")
130
- .setDescription("Must be a number")
131
- .setRequired(true) // A required option
132
- .setValidator(val => !isNaN(Number(val))) // Validate value
133
- )
134
- .setExecute(async command => {
135
- const quantity = Number(command.options.getValue('quantity', true));
136
-
137
- await command.message.reply("Quantity: " + quantity);
138
- })
139
- ```
140
-
141
- ## Command Cooldowns
142
-
143
- * Read docs for [SlashCommandBuilder#setCooldown()](https://reciple.js.org/#/docs/reciple.js/main/class/SlashCommandBuilder?scrollTo=setCooldown), [MessageCommandBuilder#setCooldown()](https://reciple.js.org/#/docs/reciple.js/main/class/MessageCommandBuilder?scrollTo=setCooldown), [CommandHaltReason](https://reciple.js.org/#/docs/reciple.js/main/typedef/CommandHaltReason), [CommandCooldownData](https://reciple.js.org/#/docs/reciple.js/main/typedef/CommandCooldownData)
144
-
145
- ```js
146
- // Slash command
147
- new SlashCommandBuilder()
148
- .setName("command")
149
- .setDescription("Your lil tiny description")
150
- .setCooldown(1000 * 60) // Cooldown in milliseconds
151
- .setExecute(command => command.interaction.reply('hi'))
152
- .setHalt(async halt => {
153
- // Handle command on cooldown
154
- if (halt.reason == CommandHaltReason.Cooldown) {
155
- await halt.executeData.interaction.reply((halt.expireTime - Date.now()) / 1000 + " seconds cooldown");
156
- return true;
157
- }
158
- })
159
-
160
- // Message command
161
- new MessageCommandBuilder()
162
- .setName("command")
163
- .setDescription("Your lil tiny description")
164
- .setCooldown(1000 * 60) // Cooldown in milliseconds
165
- .setExecute(command => command.message.reply('hi'))
166
- .setHalt(async halt => {
167
- // Handle command on cooldown
168
- if (halt.reason == CommandHaltReason.Cooldown) {
169
- await halt.executeData.message.reply((halt.expireTime - Date.now()) / 1000 + " seconds cooldown");
170
- return true;
171
- }
172
- })
173
- ```
174
-
175
- ***
176
-
177
- > ## Fun Fact
178
- > The name reciple is from a minecraft bug. The bug was a misspelling of the word `recipe`. [View Mojang Bug Report](https://bugs.mojang.com/browse/MC-225837)
179
-
180
- ***
181
-
182
- [#letTheEarthBreathe](https://rebellion.global/)
1
+ <h1 align="center">
2
+ <img src="https://i.imgur.com/DWM0tJL.png" width="50%">
3
+ <br>
4
+ </h1>
5
+
6
+ <h3 align="center">
7
+ <a href="https://npmjs.org/package/reciple">
8
+ <img src="https://img.shields.io/npm/v/reciple?label=latest%20npm%20release%20">
9
+ </a>
10
+ <a href="https://github.com/FalloutStudios/Reciple/blob/main/LICENSE">
11
+ <img src="https://img.shields.io/github/license/FalloutStudios/Reciple">
12
+ </a>
13
+ <a href="https://www.codefactor.io/repository/github/falloutstudios/reciple/overview/main">
14
+ <img src="https://www.codefactor.io/repository/github/falloutstudios/reciple/badge/main">
15
+ </a>
16
+
17
+ A simple Dicord.js handler that just works.
18
+ </h3>
19
+
20
+ ***
21
+
22
+ <p align="center">
23
+ <a href="https://discord.gg/2CattJYNpw" title="">
24
+ <img src="https://i.imgur.com/GffJByO.png" alt="Join Discord">
25
+ </a>
26
+ </p>
27
+
28
+ # Features
29
+
30
+ * [CLI based handler](#command-line)
31
+ * [Message command builder](#messagecommandbuilder-example)
32
+ * [Built-in message command validation](#built-in-message-command-validation)
33
+ * Automatically register application commands
34
+ * [Built-in command cooldowns](#command-cooldowns)
35
+ * [Highly configurable](#config)
36
+
37
+ ## Installation
38
+
39
+ To install the bot, run the following command in your terminal:
40
+
41
+ ```bash
42
+ npm i reciple discord.js
43
+ ```
44
+
45
+ You can initialize the bot to the current directory with the following command in your terminal:
46
+
47
+ ```bash
48
+ npx reciple
49
+ ```
50
+
51
+ It will ask you to continue if the directory is not empty. Type `y` to continue. After the bot has been initialized, it will ask you for your bot token.
52
+
53
+ > You can change the token anytime you want
54
+
55
+ ## Config
56
+
57
+ You can configure the bot in `reciple.yml` located in the bot's root directory.
58
+
59
+ ### Token
60
+
61
+ You can directly change the token in `reciple.yml`.
62
+
63
+ ```yml
64
+ token: "YOUR_TOKEN_HERE"
65
+ ```
66
+
67
+ Using environment variables is also supported.
68
+
69
+ ```yml
70
+ token: "env:TOKEN_VARIABLE"
71
+ ```
72
+
73
+ You can override the given token using your terminal
74
+
75
+ ```bash
76
+ npx reciple --token "YOUR_TOKEN_HERE"
77
+ ```
78
+
79
+ Use env variable
80
+
81
+ ```bash
82
+ npx reciple --token "env:TOKEN_VARIABLE"
83
+ ```
84
+
85
+ ## Starting the bot
86
+ To start the bot, run the following command:
87
+
88
+ ```bash
89
+ npx reciple
90
+ ```
91
+
92
+ ## Command line
93
+
94
+ **Usage:** `reciple [options] [current-working-directory]`
95
+
96
+ **Arguments:**
97
+ * `current-working-directory` Change the current working directory
98
+
99
+ **Options:**
100
+ * `-v, --version` output the version number
101
+ * `-t, --token <token>` Replace used bot token
102
+ * `-c, --config <config>` Change path to config file
103
+ * `-D, --debugmode` Enable debug mode
104
+ * `-y, --yes` Automatically agree to Reciple confirmation prompts
105
+ * `-h, --help` display help for command
106
+
107
+ ## MessageCommandBuilder Example
108
+
109
+ * Read docs for [MessageCommandBuilder](https://reciple.js.org/#/docs/reciple.js/main/class/MessageCommandBuilder)
110
+
111
+ ```js
112
+ new MessageCommandBuilder()
113
+ .setName("command")
114
+ .setDescription("Your lil tiny description")
115
+ .addAliases('cmd', 'cmd1')
116
+ .setExecute(command => command.message.reply("Hello!"))
117
+ ```
118
+
119
+ ## Built-in message command validation
120
+
121
+ * Read docs for [MessageCommandBuilder#setValidateOptions()](https://reciple.js.org/#/docs/reciple.js/main/class/MessageCommandBuilder?scrollTo=setValidateOptions), [MessageCommandOptionBuilder](https://reciple.js.org/#/docs/reciple.js/main/class/MessageCommandOptionBuilder), [MessageCommandOptionManager](https://reciple.js.org/#/docs/reciple.js/main/class/MessageCommandOptionManager)
122
+ ```js
123
+ new MessageCommandBuilder()
124
+ .setName("command")
125
+ .setDescription("Your lil tiny description")
126
+ .addAliases('cmd', 'cmd1')
127
+ .setValidateOptions(true) // Validate options
128
+ .addOption(option => option
129
+ .setName("quantity")
130
+ .setDescription("Must be a number")
131
+ .setRequired(true) // A required option
132
+ .setValidator(val => !isNaN(Number(val))) // Validate value
133
+ )
134
+ .setExecute(async command => {
135
+ const quantity = Number(command.options.getValue('quantity', true));
136
+
137
+ await command.message.reply("Quantity: " + quantity);
138
+ })
139
+ ```
140
+
141
+ ## Command Cooldowns
142
+
143
+ * Read docs for [SlashCommandBuilder#setCooldown()](https://reciple.js.org/#/docs/reciple.js/main/class/SlashCommandBuilder?scrollTo=setCooldown), [MessageCommandBuilder#setCooldown()](https://reciple.js.org/#/docs/reciple.js/main/class/MessageCommandBuilder?scrollTo=setCooldown), [CommandHaltReason](https://reciple.js.org/#/docs/reciple.js/main/typedef/CommandHaltReason), [CommandCooldownData](https://reciple.js.org/#/docs/reciple.js/main/typedef/CommandCooldownData)
144
+
145
+ ```js
146
+ // Slash command
147
+ new SlashCommandBuilder()
148
+ .setName("command")
149
+ .setDescription("Your lil tiny description")
150
+ .setCooldown(1000 * 60) // Cooldown in milliseconds
151
+ .setExecute(command => command.interaction.reply('hi'))
152
+ .setHalt(async halt => {
153
+ // Handle command on cooldown
154
+ if (halt.reason == CommandHaltReason.Cooldown) {
155
+ await halt.executeData.interaction.reply((halt.expireTime - Date.now()) / 1000 + " seconds cooldown");
156
+ return true;
157
+ }
158
+ })
159
+
160
+ // Message command
161
+ new MessageCommandBuilder()
162
+ .setName("command")
163
+ .setDescription("Your lil tiny description")
164
+ .setCooldown(1000 * 60) // Cooldown in milliseconds
165
+ .setExecute(command => command.message.reply('hi'))
166
+ .setHalt(async halt => {
167
+ // Handle command on cooldown
168
+ if (halt.reason == CommandHaltReason.Cooldown) {
169
+ await halt.executeData.message.reply((halt.expireTime - Date.now()) / 1000 + " seconds cooldown");
170
+ return true;
171
+ }
172
+ })
173
+ ```
174
+
175
+ ***
176
+
177
+ > ## Fun Fact
178
+ > The name reciple is from a minecraft bug. The bug was a misspelling of the word `recipe`. [View Mojang Bug Report](https://bugs.mojang.com/browse/MC-225837)
179
+
180
+ ***
181
+
182
+ [#letTheEarthBreathe](https://rebellion.global/)
package/dist/lib/bin.mjs CHANGED
@@ -35,7 +35,6 @@ const client = new RecipleClient({ config: config, cwd, ...config.client });
35
35
  */
36
36
  if (!client.isClientLogsSilent)
37
37
  client.logger.info('Starting Reciple client v' + rawVersion);
38
- client.addCommandListeners();
39
38
  await client.modules.startModules({
40
39
  modules: await client.modules.resolveModuleFiles({
41
40
  files: await client.modules.getModulePaths({
@@ -62,6 +61,14 @@ client.on(Events.ClientReady, async () => {
62
61
  if (!client.isClientLogsSilent)
63
62
  client.logger.warn(`Logged in as ${client.user?.tag || 'Unknown'}!`);
64
63
  client.on(Events.CacheSweep, () => client.cooldowns.clean());
64
+ client.on(Events.MessageCreate, message => {
65
+ if (client.config.commands.messageCommand.enabled)
66
+ client.messageCommandExecute(message);
67
+ });
68
+ client.on(Events.InteractionCreate, interaction => {
69
+ if (client.config.commands.slashCommand.enabled)
70
+ client.slashCommandExecute(interaction);
71
+ });
65
72
  });
66
73
  client.login(config.token).catch(err => {
67
74
  if (!client.isClientLogsSilent)
@@ -1 +1 @@
1
- {"version":3,"file":"bin.mjs","sourceRoot":"","sources":["../../src/bin.mts"],"names":[],"mappings":";AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,IAAI,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,KAAK,MAAM,YAAY,CAAC;AAC/B,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,eAAe,CAAC;AACvB,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEpC,MAAM,YAAY,GAAG,CAAC,cAAc,EAAE,aAAa,EAAE,cAAc,EAAE,IAAI,CAAC,CAAC;AAC3E,MAAM,UA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AAC;AACP,CAAC,CAAC,CAAC;AAEH,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE;IACnC,IAAI,CAAC,MAAM,CAAC,kBAAkB;QAAE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;AAC7D,CAAC,CAAC,CAAC"}
@@ -10,11 +10,11 @@ const builders_1 = require("../types/builders");
10
10
  const permissions_1 = require("../permissions");
11
11
  const MessageCommandOptionManager_1 = require("./managers/MessageCommandOptionManager");
12
12
  const ApplicationCommandManager_1 = require("./managers/ApplicationCommandManager");
13
+ const util_1 = require("../util");
13
14
  const CommandManager_1 = require("./managers/CommandManager");
14
15
  const ModuleManager_1 = require("./managers/ModuleManager");
15
16
  const RecipleConfig_1 = require("./RecipleConfig");
16
17
  const fallout_utility_1 = require("fallout-utility");
17
- const util_1 = require("../util");
18
18
  const version_js_1 = require("../version.js");
19
19
  const flags_1 = require("../flags");
20
20
  var RecipleEvents;
@@ -55,8 +55,10 @@ class RecipleClient extends discord_js_1.Client {
55
55
  }
56
56
  /**
57
57
  * Listed to command executions
58
+ * @deprecated Not useful
58
59
  */
59
60
  addCommandListeners() {
61
+ (0, util_1.deprecationWarning)(`RecipleClient#addCommandListeners() is deprecated! Listen to commands manually.`);
60
62
  this.on(discord_js_1.Events.MessageCreate, message => {
61
63
  if (this.config.commands.messageCommand.enabled)
62
64
  this.messageCommandExecute(message);
@@ -80,57 +82,48 @@ class RecipleClient extends discord_js_1.Client {
80
82
  if (!command)
81
83
  return;
82
84
  const executeData = {
85
+ type: command.type,
83
86
  interaction,
84
87
  builder: command,
85
88
  client: this,
86
89
  };
87
- if ((0, permissions_1.userHasCommandPermissions)({
88
- builder: command,
89
- memberPermissions: interaction.memberPermissions ?? undefined,
90
- commandPermissions: this.config.commands.slashCommand.permissions,
91
- })) {
92
- if (!command)
93
- return;
94
- if (interaction.inCachedGuild() && !(0, permissions_1.botHasExecutePermissions)(interaction.channel || interaction.guild, command.requiredBotPermissions)) {
95
- if (!(await this._haltCommand(command, {
96
- executeData,
97
- reason: commands_1.CommandHaltReason.MissingBotPermissions,
98
- }))) {
99
- await interaction.reply(this.getConfigMessage('insufficientBotPerms', 'Insufficient bot permissions.')).catch(er => this._replyError(er));
100
- }
101
- return;
102
- }
103
- const userCooldown = {
104
- user: interaction.user,
105
- command: command.name,
106
- channel: interaction.channel ?? undefined,
107
- guild: interaction.guild,
108
- type: builders_1.CommandType.SlashCommand,
109
- };
110
- if (this.config.commands.slashCommand.enableCooldown && command.cooldown && !this.cooldowns.isCooledDown(userCooldown)) {
111
- this.cooldowns.add({
112
- ...userCooldown,
113
- expireTime: Date.now() + command.cooldown,
114
- });
90
+ const userCooldown = {
91
+ user: interaction.user,
92
+ command: command.name,
93
+ channel: interaction.channel ?? undefined,
94
+ guild: interaction.guild,
95
+ type: builders_1.CommandType.SlashCommand,
96
+ };
97
+ if (this.config.commands.slashCommand.useLegacyPermissionsChecking &&
98
+ !(0, permissions_1.userHasCommandPermissions)({
99
+ builder: command,
100
+ memberPermissions: interaction.memberPermissions ?? undefined,
101
+ commandPermissions: this.config.commands.slashCommand.permissions,
102
+ })) {
103
+ if (!(await this._haltCommand(command, { executeData, reason: commands_1.CommandHaltReason.MissingMemberPermissions }))) {
104
+ await interaction.reply(this.getConfigMessage('noPermissions', 'You do not have permission to use this command.')).catch(er => this._replyError(er));
115
105
  }
116
- else if (this.config.commands.slashCommand.enableCooldown && command.cooldown) {
117
- if (!(await this._haltCommand(command, {
118
- executeData,
119
- reason: commands_1.CommandHaltReason.Cooldown,
120
- ...this.cooldowns.get(userCooldown),
121
- }))) {
122
- await interaction.reply(this.getConfigMessage('cooldown', 'You cannot execute this command right now due to the cooldown.')).catch(er => this._replyError(er));
123
- }
124
- return;
106
+ return;
107
+ }
108
+ if (interaction.inCachedGuild() && !(0, permissions_1.botHasExecutePermissions)(interaction.channel || interaction.guild, command.requiredBotPermissions)) {
109
+ if (!(await this._haltCommand(command, { executeData, reason: commands_1.CommandHaltReason.MissingBotPermissions }))) {
110
+ await interaction.reply(this.getConfigMessage('insufficientBotPerms', 'Insufficient bot permissions.')).catch(er => this._replyError(er));
125
111
  }
126
- return this._executeCommand(command, executeData);
112
+ return;
127
113
  }
128
- else if (!(await this._haltCommand(command, {
129
- executeData,
130
- reason: commands_1.CommandHaltReason.MissingMemberPermissions,
131
- }))) {
132
- await interaction.reply(this.getConfigMessage('noPermissions', 'You do not have permission to use this command.')).catch(er => this._replyError(er));
114
+ if (this.config.commands.slashCommand.enableCooldown && command.cooldown && !this.cooldowns.isCooledDown(userCooldown)) {
115
+ this.cooldowns.add({
116
+ ...userCooldown,
117
+ expireTime: Date.now() + command.cooldown,
118
+ });
133
119
  }
120
+ else if (this.config.commands.slashCommand.enableCooldown && command.cooldown) {
121
+ if (!(await this._haltCommand(command, { executeData, reason: commands_1.CommandHaltReason.Cooldown, ...this.cooldowns.get(userCooldown) }))) {
122
+ await interaction.reply(this.getConfigMessage('cooldown', 'You cannot execute this command right now due to the cooldown.')).catch(er => this._replyError(er));
123
+ }
124
+ return;
125
+ }
126
+ return this._executeCommand(command, executeData);
134
127
  }
135
128
  /**
136
129
  * Execute a Message command
@@ -148,81 +141,73 @@ class RecipleClient extends discord_js_1.Client {
148
141
  return;
149
142
  const commandOptions = await MessageCommandBuilder_1.MessageCommandBuilder.validateOptions(command, parseCommand);
150
143
  const executeData = {
144
+ type: command.type,
151
145
  message: message,
152
146
  options: commandOptions,
153
147
  command: parseCommand,
154
148
  builder: command,
155
149
  client: this,
156
150
  };
157
- if ((0, permissions_1.userHasCommandPermissions)({
151
+ const userCooldown = {
152
+ user: message.author,
153
+ command: command.name,
154
+ channel: message.channel,
155
+ guild: message.guild,
156
+ type: builders_1.CommandType.MessageCommand,
157
+ };
158
+ if ((!command.allowExecuteInDM && message.channel.type === discord_js_1.ChannelType.DM) || (!command.allowExecuteByBots && (message.author.bot || message.author.system)))
159
+ return;
160
+ if (!(0, permissions_1.userHasCommandPermissions)({
158
161
  builder: command,
159
162
  memberPermissions: message.member?.permissions,
160
163
  commandPermissions: this.config.commands.messageCommand.permissions,
161
164
  })) {
162
- if ((!command.allowExecuteInDM && message.channel.type === discord_js_1.ChannelType.DM) || (!command.allowExecuteByBots && (message.author.bot || message.author.system)))
163
- return;
164
- if (command.validateOptions) {
165
- if (commandOptions.some(o => o.invalid)) {
166
- if (!(await this._haltCommand(command, {
167
- executeData,
168
- reason: commands_1.CommandHaltReason.InvalidArguments,
169
- invalidArguments: new MessageCommandOptionManager_1.MessageCommandOptionManager(...executeData.options.filter(o => o.invalid)),
170
- }))) {
171
- message.reply(this.getConfigMessage('invalidArguments', 'Invalid argument(s) given.')).catch(er => this._replyError(er));
172
- }
173
- return;
174
- }
175
- if (commandOptions.some(o => o.missing)) {
176
- if (!(await this._haltCommand(command, {
177
- executeData,
178
- reason: commands_1.CommandHaltReason.MissingArguments,
179
- missingArguments: new MessageCommandOptionManager_1.MessageCommandOptionManager(...executeData.options.filter(o => o.missing)),
180
- }))) {
181
- message.reply(this.getConfigMessage('missingArguments', 'Not enough arguments.')).catch(er => this._replyError(er));
182
- }
183
- return;
184
- }
165
+ if (!(await this._haltCommand(command, { executeData, reason: commands_1.CommandHaltReason.MissingMemberPermissions }))) {
166
+ await message.reply(this.getConfigMessage('noPermissions', 'You do not have permission to use this command.')).catch(er => this._replyError(er));
185
167
  }
186
- if (message.inGuild() && !(0, permissions_1.botHasExecutePermissions)(message.channel || message.guild, command.requiredBotPermissions)) {
168
+ return;
169
+ }
170
+ if (command.validateOptions) {
171
+ if (commandOptions.some(o => o.invalid)) {
187
172
  if (!(await this._haltCommand(command, {
188
173
  executeData,
189
- reason: commands_1.CommandHaltReason.MissingBotPermissions,
174
+ reason: commands_1.CommandHaltReason.InvalidArguments,
175
+ invalidArguments: new MessageCommandOptionManager_1.MessageCommandOptionManager(...executeData.options.filter(o => o.invalid)),
190
176
  }))) {
191
- message.reply(this.getConfigMessage('insufficientBotPerms', 'Insufficient bot permissions.')).catch(er => this._replyError(er));
177
+ message.reply(this.getConfigMessage('invalidArguments', 'Invalid argument(s) given.')).catch(er => this._replyError(er));
192
178
  }
193
179
  return;
194
180
  }
195
- const userCooldown = {
196
- user: message.author,
197
- command: command.name,
198
- channel: message.channel,
199
- guild: message.guild,
200
- type: builders_1.CommandType.MessageCommand,
201
- };
202
- if (this.config.commands.messageCommand.enableCooldown && command.cooldown && !this.cooldowns.isCooledDown(userCooldown)) {
203
- this.cooldowns.add({
204
- ...userCooldown,
205
- expireTime: Date.now() + command.cooldown,
206
- });
207
- }
208
- else if (this.config.commands.messageCommand.enableCooldown && command.cooldown) {
181
+ if (commandOptions.some(o => o.missing)) {
209
182
  if (!(await this._haltCommand(command, {
210
183
  executeData,
211
- reason: commands_1.CommandHaltReason.Cooldown,
212
- ...this.cooldowns.get(userCooldown),
184
+ reason: commands_1.CommandHaltReason.MissingArguments,
185
+ missingArguments: new MessageCommandOptionManager_1.MessageCommandOptionManager(...executeData.options.filter(o => o.missing)),
213
186
  }))) {
214
- await message.reply(this.getConfigMessage('cooldown', 'You cannot execute this command right now due to the cooldown.')).catch(er => this._replyError(er));
187
+ message.reply(this.getConfigMessage('missingArguments', 'Not enough arguments.')).catch(er => this._replyError(er));
215
188
  }
216
189
  return;
217
190
  }
218
- return this._executeCommand(command, executeData);
219
191
  }
220
- else if (!(await this._haltCommand(command, {
221
- executeData,
222
- reason: commands_1.CommandHaltReason.MissingMemberPermissions,
223
- }))) {
224
- message.reply(this.getConfigMessage('noPermissions', 'You do not have permission to use this command.')).catch(er => this._replyError(er));
192
+ if (message.inGuild() && !(0, permissions_1.botHasExecutePermissions)(message.channel || message.guild, command.requiredBotPermissions)) {
193
+ if (!(await this._haltCommand(command, { executeData, reason: commands_1.CommandHaltReason.MissingBotPermissions }))) {
194
+ message.reply(this.getConfigMessage('insufficientBotPerms', 'Insufficient bot permissions.')).catch(er => this._replyError(er));
195
+ }
196
+ return;
197
+ }
198
+ if (this.config.commands.messageCommand.enableCooldown && command.cooldown && !this.cooldowns.isCooledDown(userCooldown)) {
199
+ this.cooldowns.add({
200
+ ...userCooldown,
201
+ expireTime: Date.now() + command.cooldown,
202
+ });
203
+ }
204
+ else if (this.config.commands.messageCommand.enableCooldown && command.cooldown) {
205
+ if (!(await this._haltCommand(command, { executeData, reason: commands_1.CommandHaltReason.Cooldown, ...this.cooldowns.get(userCooldown) }))) {
206
+ await message.reply(this.getConfigMessage('cooldown', 'You cannot execute this command right now due to the cooldown.')).catch(er => this._replyError(er));
207
+ }
208
+ return;
225
209
  }
210
+ return this._executeCommand(command, executeData);
226
211
  }
227
212
  /**
228
213
  * Get a message from config