reciple 6.0.0-dev.23 → 6.0.0-dev.25
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/LICENSE +674 -674
- package/README.md +183 -183
- package/dist/lib/bin.mjs +66 -65
- package/dist/lib/esm.mjs +1 -1
- package/dist/lib/index.js +33 -35
- package/dist/lib/reciple/classes/RecipleClient.js +296 -296
- package/dist/lib/reciple/classes/RecipleConfig.js +106 -106
- package/dist/lib/reciple/classes/RecipleModule.js +94 -94
- package/dist/lib/reciple/classes/builders/MessageCommandBuilder.js +309 -325
- package/dist/lib/reciple/classes/builders/MessageCommandOptionBuilder.js +126 -107
- package/dist/lib/reciple/classes/builders/SlashCommandBuilder.js +246 -246
- package/dist/lib/reciple/classes/managers/ApplicationCommandManager.js +178 -178
- package/dist/lib/reciple/classes/managers/CommandCooldownManager.js +99 -100
- package/dist/lib/reciple/classes/managers/CommandManager.js +59 -59
- package/dist/lib/reciple/classes/managers/MessageCommandOptionManager.js +25 -25
- package/dist/lib/reciple/classes/managers/ModuleManager.js +176 -179
- package/dist/lib/reciple/flags.js +31 -31
- package/dist/lib/reciple/permissions.js +30 -30
- package/dist/lib/reciple/types/builders.js +11 -11
- package/dist/lib/reciple/types/commands.js +15 -15
- package/dist/lib/reciple/types/paramOptions.js +2 -2
- package/dist/lib/reciple/util.js +69 -68
- package/dist/lib/reciple/version.js +47 -47
- package/dist/types/bin.d.mts +2 -2
- package/dist/types/esm.d.mts +1 -1
- package/dist/types/index.d.ts +17 -19
- package/dist/types/reciple/classes/RecipleClient.d.ts +104 -103
- package/dist/types/reciple/classes/RecipleConfig.d.ts +100 -100
- package/dist/types/reciple/classes/RecipleModule.d.ts +56 -56
- package/dist/types/reciple/classes/builders/MessageCommandBuilder.d.ts +189 -184
- package/dist/types/reciple/classes/builders/MessageCommandOptionBuilder.d.ts +53 -51
- package/dist/types/reciple/classes/builders/SlashCommandBuilder.d.ts +98 -98
- package/dist/types/reciple/classes/managers/ApplicationCommandManager.d.ts +53 -53
- package/dist/types/reciple/classes/managers/CommandCooldownManager.d.ts +70 -70
- package/dist/types/reciple/classes/managers/CommandManager.d.ts +34 -36
- package/dist/types/reciple/classes/managers/MessageCommandOptionManager.d.ts +22 -22
- package/dist/types/reciple/classes/managers/ModuleManager.d.ts +49 -49
- package/dist/types/reciple/flags.d.ts +17 -17
- package/dist/types/reciple/permissions.d.ts +15 -19
- package/dist/types/reciple/types/builders.d.ts +205 -197
- package/dist/types/reciple/types/commands.d.ts +81 -81
- package/dist/types/reciple/types/paramOptions.d.ts +101 -101
- package/dist/types/reciple/util.d.ts +26 -23
- package/dist/types/reciple/version.d.ts +25 -25
- package/package.json +21 -20
- package/resource/reciple.yml +120 -120
package/README.md
CHANGED
|
@@ -1,183 +1,183 @@
|
|
|
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
|
|
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
|
-
* `-v, --version` Display version
|
|
106
|
-
* `-h, --help` display help for command
|
|
107
|
-
|
|
108
|
-
## MessageCommandBuilder Example
|
|
109
|
-
|
|
110
|
-
* Read docs for [MessageCommandBuilder](https://reciple.js.org/#/docs/reciple.js/main/class/MessageCommandBuilder)
|
|
111
|
-
|
|
112
|
-
```js
|
|
113
|
-
new MessageCommandBuilder()
|
|
114
|
-
.setName("command")
|
|
115
|
-
.setDescription("Your lil tiny description")
|
|
116
|
-
.addAliases('cmd', 'cmd1')
|
|
117
|
-
.setExecute(command => command.message.reply("Hello!"))
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
## Built-in message command validation
|
|
121
|
-
|
|
122
|
-
* 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)
|
|
123
|
-
```js
|
|
124
|
-
new MessageCommandBuilder()
|
|
125
|
-
.setName("command")
|
|
126
|
-
.setDescription("Your lil tiny description")
|
|
127
|
-
.addAliases('cmd', 'cmd1')
|
|
128
|
-
.setValidateOptions(true) // Validate options
|
|
129
|
-
.addOption(option => option
|
|
130
|
-
.setName("quantity")
|
|
131
|
-
.setDescription("Must be a number")
|
|
132
|
-
.setRequired(true) // A required option
|
|
133
|
-
.setValidator(val => !isNaN(Number(val))) // Validate value
|
|
134
|
-
)
|
|
135
|
-
.setExecute(async command => {
|
|
136
|
-
const quantity = Number(command.options.getValue('quantity', true));
|
|
137
|
-
|
|
138
|
-
await command.message.reply("Quantity: " + quantity);
|
|
139
|
-
})
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
## Command Cooldowns
|
|
143
|
-
|
|
144
|
-
* 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)
|
|
145
|
-
|
|
146
|
-
```js
|
|
147
|
-
// Slash command
|
|
148
|
-
new SlashCommandBuilder()
|
|
149
|
-
.setName("command")
|
|
150
|
-
.setDescription("Your lil tiny description")
|
|
151
|
-
.setCooldown(1000 * 60) // Cooldown in milliseconds
|
|
152
|
-
.setExecute(command => command.interaction.reply('hi'))
|
|
153
|
-
.setHalt(async halt => {
|
|
154
|
-
// Handle command on cooldown
|
|
155
|
-
if (halt.reason == CommandHaltReason.Cooldown) {
|
|
156
|
-
await halt.executeData.interaction.reply((halt.expireTime - Date.now()) / 1000 + " seconds cooldown");
|
|
157
|
-
return true;
|
|
158
|
-
}
|
|
159
|
-
})
|
|
160
|
-
|
|
161
|
-
// Message command
|
|
162
|
-
new MessageCommandBuilder()
|
|
163
|
-
.setName("command")
|
|
164
|
-
.setDescription("Your lil tiny description")
|
|
165
|
-
.setCooldown(1000 * 60) // Cooldown in milliseconds
|
|
166
|
-
.setExecute(command => command.message.reply('hi'))
|
|
167
|
-
.setHalt(async halt => {
|
|
168
|
-
// Handle command on cooldown
|
|
169
|
-
if (halt.reason == CommandHaltReason.Cooldown) {
|
|
170
|
-
await halt.executeData.message.reply((halt.expireTime - Date.now()) / 1000 + " seconds cooldown");
|
|
171
|
-
return true;
|
|
172
|
-
}
|
|
173
|
-
})
|
|
174
|
-
```
|
|
175
|
-
|
|
176
|
-
***
|
|
177
|
-
|
|
178
|
-
> ## Fun Fact
|
|
179
|
-
> 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)
|
|
180
|
-
|
|
181
|
-
***
|
|
182
|
-
|
|
183
|
-
[#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
|
|
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
|
+
* `-v, --version` Display version
|
|
106
|
+
* `-h, --help` display help for command
|
|
107
|
+
|
|
108
|
+
## MessageCommandBuilder Example
|
|
109
|
+
|
|
110
|
+
* Read docs for [MessageCommandBuilder](https://reciple.js.org/#/docs/reciple.js/main/class/MessageCommandBuilder)
|
|
111
|
+
|
|
112
|
+
```js
|
|
113
|
+
new MessageCommandBuilder()
|
|
114
|
+
.setName("command")
|
|
115
|
+
.setDescription("Your lil tiny description")
|
|
116
|
+
.addAliases('cmd', 'cmd1')
|
|
117
|
+
.setExecute(command => command.message.reply("Hello!"))
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Built-in message command validation
|
|
121
|
+
|
|
122
|
+
* 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)
|
|
123
|
+
```js
|
|
124
|
+
new MessageCommandBuilder()
|
|
125
|
+
.setName("command")
|
|
126
|
+
.setDescription("Your lil tiny description")
|
|
127
|
+
.addAliases('cmd', 'cmd1')
|
|
128
|
+
.setValidateOptions(true) // Validate options
|
|
129
|
+
.addOption(option => option
|
|
130
|
+
.setName("quantity")
|
|
131
|
+
.setDescription("Must be a number")
|
|
132
|
+
.setRequired(true) // A required option
|
|
133
|
+
.setValidator(val => !isNaN(Number(val))) // Validate value
|
|
134
|
+
)
|
|
135
|
+
.setExecute(async command => {
|
|
136
|
+
const quantity = Number(command.options.getValue('quantity', true));
|
|
137
|
+
|
|
138
|
+
await command.message.reply("Quantity: " + quantity);
|
|
139
|
+
})
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Command Cooldowns
|
|
143
|
+
|
|
144
|
+
* 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)
|
|
145
|
+
|
|
146
|
+
```js
|
|
147
|
+
// Slash command
|
|
148
|
+
new SlashCommandBuilder()
|
|
149
|
+
.setName("command")
|
|
150
|
+
.setDescription("Your lil tiny description")
|
|
151
|
+
.setCooldown(1000 * 60) // Cooldown in milliseconds
|
|
152
|
+
.setExecute(command => command.interaction.reply('hi'))
|
|
153
|
+
.setHalt(async halt => {
|
|
154
|
+
// Handle command on cooldown
|
|
155
|
+
if (halt.reason == CommandHaltReason.Cooldown) {
|
|
156
|
+
await halt.executeData.interaction.reply((halt.expireTime - Date.now()) / 1000 + " seconds cooldown");
|
|
157
|
+
return true;
|
|
158
|
+
}
|
|
159
|
+
})
|
|
160
|
+
|
|
161
|
+
// Message command
|
|
162
|
+
new MessageCommandBuilder()
|
|
163
|
+
.setName("command")
|
|
164
|
+
.setDescription("Your lil tiny description")
|
|
165
|
+
.setCooldown(1000 * 60) // Cooldown in milliseconds
|
|
166
|
+
.setExecute(command => command.message.reply('hi'))
|
|
167
|
+
.setHalt(async halt => {
|
|
168
|
+
// Handle command on cooldown
|
|
169
|
+
if (halt.reason == CommandHaltReason.Cooldown) {
|
|
170
|
+
await halt.executeData.message.reply((halt.expireTime - Date.now()) / 1000 + " seconds cooldown");
|
|
171
|
+
return true;
|
|
172
|
+
}
|
|
173
|
+
})
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
***
|
|
177
|
+
|
|
178
|
+
> ## Fun Fact
|
|
179
|
+
> 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)
|
|
180
|
+
|
|
181
|
+
***
|
|
182
|
+
|
|
183
|
+
[#letTheEarthBreathe](https://rebellion.global/)
|
package/dist/lib/bin.mjs
CHANGED
|
@@ -1,65 +1,66 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { RecipleClient } from './reciple/classes/RecipleClient.js';
|
|
3
|
-
import { RecipleConfig } from './reciple/classes/RecipleConfig.js';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { cwd, flags } from './reciple/flags.js';
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
10
|
-
import '
|
|
11
|
-
import
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
client.
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
})
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
client.
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
process.once('
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { RecipleClient } from './reciple/classes/RecipleClient.js';
|
|
3
|
+
import { RecipleConfig } from './reciple/classes/RecipleConfig.js';
|
|
4
|
+
import { existsSync, mkdirSync, readdirSync } from 'fs';
|
|
5
|
+
import { rawVersion } from './reciple/version.js';
|
|
6
|
+
import { cwd, flags } from './reciple/flags.js';
|
|
7
|
+
import { path } from './reciple/util.js';
|
|
8
|
+
import { input } from 'fallout-utility';
|
|
9
|
+
import match from 'micromatch';
|
|
10
|
+
import { inspect } from 'util';
|
|
11
|
+
import chalk from 'chalk';
|
|
12
|
+
import 'dotenv/config';
|
|
13
|
+
const allowedFiles = ['node_modules', 'reciple.yml', 'package.json', '.*'];
|
|
14
|
+
const configPath = path.join(cwd, 'reciple.yml');
|
|
15
|
+
if (!existsSync(cwd))
|
|
16
|
+
mkdirSync(cwd, { recursive: true });
|
|
17
|
+
if (readdirSync(cwd).some(f => match.isMatch(f, allowedFiles)) && !existsSync(flags.config ?? configPath)) {
|
|
18
|
+
const ask = (flags.yes ? 'y' : null) ?? input('Would you like to create Reciple config here? [y/n] ') ?? '';
|
|
19
|
+
if (ask.toString().toLowerCase() !== 'y')
|
|
20
|
+
process.exit(0);
|
|
21
|
+
}
|
|
22
|
+
let configParser;
|
|
23
|
+
try {
|
|
24
|
+
configParser = new RecipleConfig(flags.config ?? configPath).parseConfig();
|
|
25
|
+
}
|
|
26
|
+
catch (err) {
|
|
27
|
+
console.error(`${chalk.bold.red('Config Error')}: ${inspect(err)}`);
|
|
28
|
+
process.exit(1);
|
|
29
|
+
}
|
|
30
|
+
const config = configParser.getConfig();
|
|
31
|
+
const client = new RecipleClient({ config: config, cwd, ...config.client });
|
|
32
|
+
/**
|
|
33
|
+
* Start
|
|
34
|
+
*/
|
|
35
|
+
if (!client.isClientLogsSilent)
|
|
36
|
+
client.logger.info('Starting Reciple client v' + rawVersion);
|
|
37
|
+
client.addCommandListeners();
|
|
38
|
+
await client.modules.startModules({
|
|
39
|
+
modules: await client.modules.resolveModuleFiles({
|
|
40
|
+
files: await client.modules.getModulePaths({
|
|
41
|
+
filter: file => file.endsWith('.js') || file.endsWith('.cjs') || file.endsWith('.mjs'),
|
|
42
|
+
}),
|
|
43
|
+
}),
|
|
44
|
+
});
|
|
45
|
+
client.on('ready', async () => {
|
|
46
|
+
await client.modules.loadModules();
|
|
47
|
+
const unloadModulesAndStopProcess = async (signal) => {
|
|
48
|
+
await client.modules.unloadModules({ reason: 'ProcessExit' });
|
|
49
|
+
client.logger.warn(`Exitting process${signal === 'SIGINT' ? ': keyboard interrupt' : signal === 'SIGTERM' ? ': terminate' : signal}`);
|
|
50
|
+
process.exit();
|
|
51
|
+
};
|
|
52
|
+
process.once('SIGINT', signal => unloadModulesAndStopProcess(signal));
|
|
53
|
+
process.once('SIGTERM', signal => unloadModulesAndStopProcess(signal));
|
|
54
|
+
if (!client.isClientLogsSilent)
|
|
55
|
+
client.logger.log(`Loaded ${client.commands.slashCommands.size} slash commands`, `Loaded ${client.commands.messageCommands.size} message commands`);
|
|
56
|
+
if (client.config.commands.slashCommand.registerCommands && (client.config.commands.slashCommand.allowRegisterEmptyCommandList || client.applicationCommands.size)) {
|
|
57
|
+
await client.commands.registerApplicationCommands();
|
|
58
|
+
}
|
|
59
|
+
if (!client.isClientLogsSilent)
|
|
60
|
+
client.logger.warn(`Logged in as ${client.user?.tag || 'Unknown'}!`);
|
|
61
|
+
client.on('cacheSweep', () => client.cooldowns.clean());
|
|
62
|
+
});
|
|
63
|
+
client.login(config.token).catch(err => {
|
|
64
|
+
if (!client.isClientLogsSilent)
|
|
65
|
+
client.logger.error(err);
|
|
66
|
+
});
|
package/dist/lib/esm.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './index.js';
|
|
1
|
+
export * from './index.js';
|
package/dist/lib/index.js
CHANGED
|
@@ -1,35 +1,33 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./reciple/classes/builders/MessageCommandBuilder.js"), exports);
|
|
18
|
-
__exportStar(require("./reciple/classes/builders/MessageCommandOptionBuilder.js"), exports);
|
|
19
|
-
__exportStar(require("./reciple/classes/builders/SlashCommandBuilder.js"), exports);
|
|
20
|
-
__exportStar(require("./reciple/classes/managers/ApplicationCommandManager.js"), exports);
|
|
21
|
-
__exportStar(require("./reciple/classes/managers/
|
|
22
|
-
__exportStar(require("./reciple/classes/managers/
|
|
23
|
-
__exportStar(require("./reciple/classes/managers/
|
|
24
|
-
__exportStar(require("./reciple/classes/managers/
|
|
25
|
-
__exportStar(require("./reciple/classes/RecipleClient.js"), exports);
|
|
26
|
-
__exportStar(require("./reciple/classes/RecipleConfig.js"), exports);
|
|
27
|
-
__exportStar(require("./reciple/classes/RecipleModule.js"), exports);
|
|
28
|
-
__exportStar(require("./reciple/types/builders.js"), exports);
|
|
29
|
-
__exportStar(require("./reciple/types/commands.js"), exports);
|
|
30
|
-
__exportStar(require("./reciple/
|
|
31
|
-
__exportStar(require("./reciple/
|
|
32
|
-
__exportStar(require("./reciple/
|
|
33
|
-
__exportStar(require("./reciple/
|
|
34
|
-
__exportStar(require("./reciple/util.js"), exports);
|
|
35
|
-
__exportStar(require("./reciple/version.js"), exports);
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./reciple/classes/builders/MessageCommandBuilder.js"), exports);
|
|
18
|
+
__exportStar(require("./reciple/classes/builders/MessageCommandOptionBuilder.js"), exports);
|
|
19
|
+
__exportStar(require("./reciple/classes/builders/SlashCommandBuilder.js"), exports);
|
|
20
|
+
__exportStar(require("./reciple/classes/managers/ApplicationCommandManager.js"), exports);
|
|
21
|
+
__exportStar(require("./reciple/classes/managers/CommandCooldownManager.js"), exports);
|
|
22
|
+
__exportStar(require("./reciple/classes/managers/CommandManager.js"), exports);
|
|
23
|
+
__exportStar(require("./reciple/classes/managers/MessageCommandOptionManager.js"), exports);
|
|
24
|
+
__exportStar(require("./reciple/classes/managers/ModuleManager.js"), exports);
|
|
25
|
+
__exportStar(require("./reciple/classes/RecipleClient.js"), exports);
|
|
26
|
+
__exportStar(require("./reciple/classes/RecipleConfig.js"), exports);
|
|
27
|
+
__exportStar(require("./reciple/classes/RecipleModule.js"), exports);
|
|
28
|
+
__exportStar(require("./reciple/types/builders.js"), exports);
|
|
29
|
+
__exportStar(require("./reciple/types/commands.js"), exports);
|
|
30
|
+
__exportStar(require("./reciple/flags"), exports);
|
|
31
|
+
__exportStar(require("./reciple/permissions.js"), exports);
|
|
32
|
+
__exportStar(require("./reciple/util.js"), exports);
|
|
33
|
+
__exportStar(require("./reciple/version.js"), exports);
|