reciple 9.1.0 → 9.2.0
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/README.md +208 -208
- package/dist/bin.js +1 -0
- package/dist/bin.js.map +1 -1
- package/dist/classes/Config.d.ts +18 -2
- package/dist/classes/Config.js +26 -1
- package/dist/classes/Config.js.map +1 -1
- package/dist/exports.js.map +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/utils/cli.d.ts +1 -1
- package/dist/utils/cli.js +2 -2
- package/dist/utils/cli.js.map +1 -1
- package/dist/utils/logger.d.ts +23 -2
- package/dist/utils/logger.js +22 -0
- package/dist/utils/logger.js.map +1 -1
- package/dist/utils/modules.d.ts +9 -2
- package/dist/utils/modules.js +7 -0
- package/dist/utils/modules.js.map +1 -1
- package/package.json +5 -4
- package/static/config.mjs +79 -79
package/README.md
CHANGED
|
@@ -1,208 +1,208 @@
|
|
|
1
|
-
<h1 align="center">
|
|
2
|
-
<img src="https://i.imgur.com/h0ljJR5.png" width="50%">
|
|
3
|
-
<br>
|
|
4
|
-
</h1>
|
|
5
|
-
|
|
6
|
-
<h3 align="center">
|
|
7
|
-
<a href="https://discord.gg/
|
|
8
|
-
<img src="https://img.shields.io/discord/1032785824686817291?color=5865F2&logo=discord&logoColor=white">
|
|
9
|
-
</a>
|
|
10
|
-
<a href="https://npmjs.org/package/reciple">
|
|
11
|
-
<img src="https://img.shields.io/npm/v/reciple?label=npm">
|
|
12
|
-
</a>
|
|
13
|
-
<a href="https://github.com/thenorthsolution/Reciple/tree/main/packages/reciple">
|
|
14
|
-
<img src="https://img.shields.io/npm/dt/reciple?maxAge=3600">
|
|
15
|
-
</a>
|
|
16
|
-
<a href="https://www.codefactor.io/repository/github/thenorthsolution/reciple">
|
|
17
|
-
<img src="https://www.codefactor.io/repository/github/thenorthsolution/reciple/badge">
|
|
18
|
-
</a>
|
|
19
|
-
<br>
|
|
20
|
-
<div style="padding-top: 1rem">
|
|
21
|
-
<a href="https://discord.gg/
|
|
22
|
-
<img src="http://invidget.switchblade.xyz/
|
|
23
|
-
</a>
|
|
24
|
-
</div>
|
|
25
|
-
</h3>
|
|
26
|
-
|
|
27
|
-
---
|
|
28
|
-
|
|
29
|
-
## Highlights
|
|
30
|
-
|
|
31
|
-
- [CLI based handler](#cli-usage)
|
|
32
|
-
- [Supports Context Menus](#context-menus)
|
|
33
|
-
- [Supports Prefix/Message commands](#message-commands)
|
|
34
|
-
- [Validate messsage command options](#validate-message-command-options)
|
|
35
|
-
- [Supports Slash Commands](#slash-commands)
|
|
36
|
-
- [Built-in command cooldowns](#command-cooldowns)
|
|
37
|
-
- Automatically register application commands
|
|
38
|
-
- [Highly configurable](#config)
|
|
39
|
-
|
|
40
|
-
## Using Templates
|
|
41
|
-
|
|
42
|
-
To use templates use the following command in your terminal:
|
|
43
|
-
|
|
44
|
-
```bash
|
|
45
|
-
npm create reciple@latest
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
After that configure the template you want to use. [Learn More](https://reciple.js.org/guide/getting-started/installation)
|
|
49
|
-
|
|
50
|
-
## CLI usage
|
|
51
|
-
|
|
52
|
-
```yml
|
|
53
|
-
Usage: reciple [options] [cwd]
|
|
54
|
-
|
|
55
|
-
Reciple is a Discord.js bot framework
|
|
56
|
-
|
|
57
|
-
Arguments:
|
|
58
|
-
cwd Change the current working directory
|
|
59
|
-
|
|
60
|
-
Options:
|
|
61
|
-
-v, --version output the version number
|
|
62
|
-
-t, --token <token> Replace used bot token
|
|
63
|
-
-c, --config <dir> Set path to a config file
|
|
64
|
-
-D, --debugmode Enable debug mode
|
|
65
|
-
-y, --yes Agree to all Reciple confirmation prompts
|
|
66
|
-
--env <file> .env file location
|
|
67
|
-
--shardmode Modifies some functionalities to support sharding
|
|
68
|
-
--setup Create required config without starting the bot
|
|
69
|
-
-h, --help display help for command
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
## Message Commands
|
|
73
|
-
|
|
74
|
-
Reciple provides a built-in `MessageCommandBuilder` class that can be used for message command handler.
|
|
75
|
-
|
|
76
|
-
[**Read Docs**](https://reciple.js.org/docs/core/main/classes:MessageCommandBuilder)
|
|
77
|
-
```js
|
|
78
|
-
import { MessageCommandBuilder } from 'reciple';
|
|
79
|
-
|
|
80
|
-
new MessageCommandBuilder()
|
|
81
|
-
.setName("command")
|
|
82
|
-
.setDescription("Your lil tiny description")
|
|
83
|
-
.addAliases("cmd", "cmd1")
|
|
84
|
-
.setExecute(command => command.message.reply("Hello!"));
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
### Validate Message Command Options
|
|
88
|
-
|
|
89
|
-
[**Read Docs**](https://reciple.js.org/docs/core/main/classes:MessageCommandOptionBuilder)
|
|
90
|
-
```js
|
|
91
|
-
import { MessageCommandBuilder } from 'reciple';
|
|
92
|
-
|
|
93
|
-
new MessageCommandBuilder()
|
|
94
|
-
.setName("command")
|
|
95
|
-
.setDescription("Your lil tiny description")
|
|
96
|
-
.addAliases("cmd", "cmd1")
|
|
97
|
-
.setValidateOptions(true) // Validate options
|
|
98
|
-
.addOption(option => option
|
|
99
|
-
.setName("quantity")
|
|
100
|
-
.setDescription("Must be a number")
|
|
101
|
-
.setRequired(true) // A required option
|
|
102
|
-
.setValidate(({ value }) => !isNaN(Number(value))) // Validate value
|
|
103
|
-
.setResolveValue(({ value }) => Number(value)) // Resolves the option value
|
|
104
|
-
)
|
|
105
|
-
.setExecute(async command => {
|
|
106
|
-
/**
|
|
107
|
-
* @type {number}
|
|
108
|
-
*/
|
|
109
|
-
const quantity = await data.options.getOptionValue('number', { required: true, resolveValue: true });;
|
|
110
|
-
await command.message.reply("Quantity: " + quantity);
|
|
111
|
-
});
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
## Context Menus
|
|
115
|
-
|
|
116
|
-
Reciple provides extended `ContextMenuCommandBuilder` class that can be used for context menu command handler.
|
|
117
|
-
|
|
118
|
-
[**Read Docs**](https://reciple.js.org/docs/core/main/classes:ContextMenuCommandBuilder)
|
|
119
|
-
```js
|
|
120
|
-
import { ApplicationCommandType } from 'discord.js';
|
|
121
|
-
import { ContextMenuCommandBuilder } from 'reciple';
|
|
122
|
-
|
|
123
|
-
new ContextMenuCommandBuilder()
|
|
124
|
-
.setName("Ban")
|
|
125
|
-
.setType(ApplicationCommandType.User)
|
|
126
|
-
.setExecute(async ({ interaction }) => {
|
|
127
|
-
if (!interaction.inCachedGuild()) return;
|
|
128
|
-
|
|
129
|
-
await interaction.deferReply();
|
|
130
|
-
await interaction.targetMember.ban();
|
|
131
|
-
await interaction.editReply(`Banned ${interaction.targetUser}`);
|
|
132
|
-
});
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
## Slash Commands
|
|
136
|
-
|
|
137
|
-
Reciple provides extended `SlashCommandBuilder` class that can be used for slash command handler.
|
|
138
|
-
[**Read Docs**](https://reciple.js.org/docs/core/main/classes:SlashCommandBuilder)
|
|
139
|
-
|
|
140
|
-
```js
|
|
141
|
-
import { SlashCommandMenuBuilder } from 'reciple';
|
|
142
|
-
|
|
143
|
-
new SlashCommandBuilder()
|
|
144
|
-
.setName("ping")
|
|
145
|
-
.setDescription("Pong")
|
|
146
|
-
.setExecute(async ({ interaction }) => {
|
|
147
|
-
await interaction.reply(`Pong!`);
|
|
148
|
-
});
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
## Command Cooldowns
|
|
152
|
-
|
|
153
|
-
[**Read Docs**](https://reciple.js.org/docs/core/main/classes:BaseCommandBuilder#setcooldown)
|
|
154
|
-
|
|
155
|
-
```js
|
|
156
|
-
import { ContextMenuCommandBuilder, MessageCommandBuilder, SlashCommandBuilder } from 'reciple';
|
|
157
|
-
import { ApplicationCommandType } from 'discord.js';
|
|
158
|
-
|
|
159
|
-
new ContextMenuCommandBuilder()
|
|
160
|
-
.setName("Context Menu")
|
|
161
|
-
.setType(ApplicationCommandType.Message)
|
|
162
|
-
.setCooldown(1000 * 5) // 5 seconds cooldown
|
|
163
|
-
.setExecute(async ({ interaction }) => {
|
|
164
|
-
await interaction.reply(`Hello!`);
|
|
165
|
-
});
|
|
166
|
-
|
|
167
|
-
new MessageCommandBuilder()
|
|
168
|
-
.setName("message-command")
|
|
169
|
-
.setDescription(`Your command`)
|
|
170
|
-
.setCooldown(1000 * 5) // 5 seconds cooldown
|
|
171
|
-
.setExecute(async ({ message }) => {
|
|
172
|
-
await message.reply(`Hello!`);
|
|
173
|
-
});
|
|
174
|
-
|
|
175
|
-
new SlashCommandBuilder()
|
|
176
|
-
.setName("slash-command")
|
|
177
|
-
.setDescription(`Your command`)
|
|
178
|
-
.setCooldown(1000 * 5) // 5 seconds cooldown
|
|
179
|
-
.setExecute(async ({ interaction }) => {
|
|
180
|
-
await interaction.reply(`Hello!`);
|
|
181
|
-
});
|
|
182
|
-
```
|
|
183
|
-
|
|
184
|
-
## Config
|
|
185
|
-
|
|
186
|
-
You can configure the bot in `reciple.mjs` usually located in the bot's root directory.
|
|
187
|
-
|
|
188
|
-
### Token
|
|
189
|
-
|
|
190
|
-
You can change the token in config.
|
|
191
|
-
|
|
192
|
-
```js
|
|
193
|
-
token: "Your Token" // Directly set token string
|
|
194
|
-
token: process.env.TOKEN // Use env variable
|
|
195
|
-
```
|
|
196
|
-
|
|
197
|
-
You can override the given token as cli flag
|
|
198
|
-
|
|
199
|
-
```bash
|
|
200
|
-
reciple --token "YOUR_TOKEN_HERE"
|
|
201
|
-
reciple --token "env:TOKEN_VARIABLE"
|
|
202
|
-
```
|
|
203
|
-
|
|
204
|
-
---
|
|
205
|
-
|
|
206
|
-
> ## Fun Fact
|
|
207
|
-
>
|
|
208
|
-
> 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)
|
|
1
|
+
<h1 align="center">
|
|
2
|
+
<img src="https://i.imgur.com/h0ljJR5.png" width="50%">
|
|
3
|
+
<br>
|
|
4
|
+
</h1>
|
|
5
|
+
|
|
6
|
+
<h3 align="center">
|
|
7
|
+
<a href="https://discord.gg/2gyckrwK7b">
|
|
8
|
+
<img src="https://img.shields.io/discord/1032785824686817291?color=5865F2&logo=discord&logoColor=white">
|
|
9
|
+
</a>
|
|
10
|
+
<a href="https://npmjs.org/package/reciple">
|
|
11
|
+
<img src="https://img.shields.io/npm/v/reciple?label=npm">
|
|
12
|
+
</a>
|
|
13
|
+
<a href="https://github.com/thenorthsolution/Reciple/tree/main/packages/reciple">
|
|
14
|
+
<img src="https://img.shields.io/npm/dt/reciple?maxAge=3600">
|
|
15
|
+
</a>
|
|
16
|
+
<a href="https://www.codefactor.io/repository/github/thenorthsolution/reciple">
|
|
17
|
+
<img src="https://www.codefactor.io/repository/github/thenorthsolution/reciple/badge">
|
|
18
|
+
</a>
|
|
19
|
+
<br>
|
|
20
|
+
<div style="padding-top: 1rem">
|
|
21
|
+
<a href="https://discord.gg/2gyckrwK7b">
|
|
22
|
+
<img src="http://invidget.switchblade.xyz/2gyckrwK7b">
|
|
23
|
+
</a>
|
|
24
|
+
</div>
|
|
25
|
+
</h3>
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## Highlights
|
|
30
|
+
|
|
31
|
+
- [CLI based handler](#cli-usage)
|
|
32
|
+
- [Supports Context Menus](#context-menus)
|
|
33
|
+
- [Supports Prefix/Message commands](#message-commands)
|
|
34
|
+
- [Validate messsage command options](#validate-message-command-options)
|
|
35
|
+
- [Supports Slash Commands](#slash-commands)
|
|
36
|
+
- [Built-in command cooldowns](#command-cooldowns)
|
|
37
|
+
- Automatically register application commands
|
|
38
|
+
- [Highly configurable](#config)
|
|
39
|
+
|
|
40
|
+
## Using Templates
|
|
41
|
+
|
|
42
|
+
To use templates use the following command in your terminal:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
npm create reciple@latest
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
After that configure the template you want to use. [Learn More](https://reciple.js.org/guide/getting-started/installation)
|
|
49
|
+
|
|
50
|
+
## CLI usage
|
|
51
|
+
|
|
52
|
+
```yml
|
|
53
|
+
Usage: reciple [options] [cwd]
|
|
54
|
+
|
|
55
|
+
Reciple is a Discord.js bot framework
|
|
56
|
+
|
|
57
|
+
Arguments:
|
|
58
|
+
cwd Change the current working directory
|
|
59
|
+
|
|
60
|
+
Options:
|
|
61
|
+
-v, --version output the version number
|
|
62
|
+
-t, --token <token> Replace used bot token
|
|
63
|
+
-c, --config <dir> Set path to a config file
|
|
64
|
+
-D, --debugmode Enable debug mode
|
|
65
|
+
-y, --yes Agree to all Reciple confirmation prompts
|
|
66
|
+
--env <file> .env file location
|
|
67
|
+
--shardmode Modifies some functionalities to support sharding
|
|
68
|
+
--setup Create required config without starting the bot
|
|
69
|
+
-h, --help display help for command
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Message Commands
|
|
73
|
+
|
|
74
|
+
Reciple provides a built-in `MessageCommandBuilder` class that can be used for message command handler.
|
|
75
|
+
|
|
76
|
+
[**Read Docs**](https://reciple.js.org/docs/core/main/classes:MessageCommandBuilder)
|
|
77
|
+
```js
|
|
78
|
+
import { MessageCommandBuilder } from 'reciple';
|
|
79
|
+
|
|
80
|
+
new MessageCommandBuilder()
|
|
81
|
+
.setName("command")
|
|
82
|
+
.setDescription("Your lil tiny description")
|
|
83
|
+
.addAliases("cmd", "cmd1")
|
|
84
|
+
.setExecute(command => command.message.reply("Hello!"));
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Validate Message Command Options
|
|
88
|
+
|
|
89
|
+
[**Read Docs**](https://reciple.js.org/docs/core/main/classes:MessageCommandOptionBuilder)
|
|
90
|
+
```js
|
|
91
|
+
import { MessageCommandBuilder } from 'reciple';
|
|
92
|
+
|
|
93
|
+
new MessageCommandBuilder()
|
|
94
|
+
.setName("command")
|
|
95
|
+
.setDescription("Your lil tiny description")
|
|
96
|
+
.addAliases("cmd", "cmd1")
|
|
97
|
+
.setValidateOptions(true) // Validate options
|
|
98
|
+
.addOption(option => option
|
|
99
|
+
.setName("quantity")
|
|
100
|
+
.setDescription("Must be a number")
|
|
101
|
+
.setRequired(true) // A required option
|
|
102
|
+
.setValidate(({ value }) => !isNaN(Number(value))) // Validate value
|
|
103
|
+
.setResolveValue(({ value }) => Number(value)) // Resolves the option value
|
|
104
|
+
)
|
|
105
|
+
.setExecute(async command => {
|
|
106
|
+
/**
|
|
107
|
+
* @type {number}
|
|
108
|
+
*/
|
|
109
|
+
const quantity = await data.options.getOptionValue('number', { required: true, resolveValue: true });;
|
|
110
|
+
await command.message.reply("Quantity: " + quantity);
|
|
111
|
+
});
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Context Menus
|
|
115
|
+
|
|
116
|
+
Reciple provides extended `ContextMenuCommandBuilder` class that can be used for context menu command handler.
|
|
117
|
+
|
|
118
|
+
[**Read Docs**](https://reciple.js.org/docs/core/main/classes:ContextMenuCommandBuilder)
|
|
119
|
+
```js
|
|
120
|
+
import { ApplicationCommandType } from 'discord.js';
|
|
121
|
+
import { ContextMenuCommandBuilder } from 'reciple';
|
|
122
|
+
|
|
123
|
+
new ContextMenuCommandBuilder()
|
|
124
|
+
.setName("Ban")
|
|
125
|
+
.setType(ApplicationCommandType.User)
|
|
126
|
+
.setExecute(async ({ interaction }) => {
|
|
127
|
+
if (!interaction.inCachedGuild()) return;
|
|
128
|
+
|
|
129
|
+
await interaction.deferReply();
|
|
130
|
+
await interaction.targetMember.ban();
|
|
131
|
+
await interaction.editReply(`Banned ${interaction.targetUser}`);
|
|
132
|
+
});
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Slash Commands
|
|
136
|
+
|
|
137
|
+
Reciple provides extended `SlashCommandBuilder` class that can be used for slash command handler.
|
|
138
|
+
[**Read Docs**](https://reciple.js.org/docs/core/main/classes:SlashCommandBuilder)
|
|
139
|
+
|
|
140
|
+
```js
|
|
141
|
+
import { SlashCommandMenuBuilder } from 'reciple';
|
|
142
|
+
|
|
143
|
+
new SlashCommandBuilder()
|
|
144
|
+
.setName("ping")
|
|
145
|
+
.setDescription("Pong")
|
|
146
|
+
.setExecute(async ({ interaction }) => {
|
|
147
|
+
await interaction.reply(`Pong!`);
|
|
148
|
+
});
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## Command Cooldowns
|
|
152
|
+
|
|
153
|
+
[**Read Docs**](https://reciple.js.org/docs/core/main/classes:BaseCommandBuilder#setcooldown)
|
|
154
|
+
|
|
155
|
+
```js
|
|
156
|
+
import { ContextMenuCommandBuilder, MessageCommandBuilder, SlashCommandBuilder } from 'reciple';
|
|
157
|
+
import { ApplicationCommandType } from 'discord.js';
|
|
158
|
+
|
|
159
|
+
new ContextMenuCommandBuilder()
|
|
160
|
+
.setName("Context Menu")
|
|
161
|
+
.setType(ApplicationCommandType.Message)
|
|
162
|
+
.setCooldown(1000 * 5) // 5 seconds cooldown
|
|
163
|
+
.setExecute(async ({ interaction }) => {
|
|
164
|
+
await interaction.reply(`Hello!`);
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
new MessageCommandBuilder()
|
|
168
|
+
.setName("message-command")
|
|
169
|
+
.setDescription(`Your command`)
|
|
170
|
+
.setCooldown(1000 * 5) // 5 seconds cooldown
|
|
171
|
+
.setExecute(async ({ message }) => {
|
|
172
|
+
await message.reply(`Hello!`);
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
new SlashCommandBuilder()
|
|
176
|
+
.setName("slash-command")
|
|
177
|
+
.setDescription(`Your command`)
|
|
178
|
+
.setCooldown(1000 * 5) // 5 seconds cooldown
|
|
179
|
+
.setExecute(async ({ interaction }) => {
|
|
180
|
+
await interaction.reply(`Hello!`);
|
|
181
|
+
});
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
## Config
|
|
185
|
+
|
|
186
|
+
You can configure the bot in `reciple.mjs` usually located in the bot's root directory.
|
|
187
|
+
|
|
188
|
+
### Token
|
|
189
|
+
|
|
190
|
+
You can change the token in config.
|
|
191
|
+
|
|
192
|
+
```js
|
|
193
|
+
token: "Your Token" // Directly set token string
|
|
194
|
+
token: process.env.TOKEN // Use env variable
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
You can override the given token as cli flag
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
reciple --token "YOUR_TOKEN_HERE"
|
|
201
|
+
reciple --token "env:TOKEN_VARIABLE"
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
206
|
+
> ## Fun Fact
|
|
207
|
+
>
|
|
208
|
+
> 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)
|
package/dist/bin.js
CHANGED
|
@@ -59,6 +59,7 @@ if (config.version && !semver.satisfies(cliVersion, config.version)) {
|
|
|
59
59
|
}
|
|
60
60
|
logger?.info(`Starting Reciple client v${buildVersion} - ${new Date()}`);
|
|
61
61
|
const client = new RecipleClient(config);
|
|
62
|
+
global.reciple = client;
|
|
62
63
|
client.setLogger(logger);
|
|
63
64
|
addEventListenersToClient(client);
|
|
64
65
|
const moduleFilesFilter = (file) => file.endsWith('.js') || file.endsWith('.cjs') || file.endsWith('.mjs');
|
package/dist/bin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,yBAAyB,EAAE,MAAM,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC5H,OAAO,EAAE,YAAY,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,
|
|
1
|
+
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,yBAAyB,EAAE,MAAM,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC5H,OAAO,EAAE,YAAY,EAAE,yBAAy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mBAAmB,CAAC,CAAC;IAC7E,MAAM,EAAE,GAAG,CAAC,UAAU,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,iCAAiC,CAAC,CAAC;IAC3F,MAAM,EAAE,GAAG,CAAC,UAAU,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,yBAAyB,CAAC,CAAC;IAE3E,IAAI,CAAC,MAAM,CAAC,eAAe;QAAE,OAAO;IAEpC,aAAa,CAAC,EAAE,CAAC,iBAAiB,EAAE,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,IAAI,CAAC,8BAA8B,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC,CAAC;IACtN,aAAa,CAAC,EAAE,CAAC,aAAa,EAAE,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,mDAAmD,GAAG,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;IACjI,aAAa,CAAC,kBAAkB,CAAC,IAAI,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;AACrD,CAAC,CAAC,CAAC;AAEH,MAAM,EAAE,KAAK,CAAC,eAAe,CAAC,CAAC;AAE/B,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,kBAAkB,CAAC,CAAC,CAAC"}
|
package/dist/classes/Config.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Logger, RecipleClientConfig } from '@reciple/core';
|
|
2
|
-
import { Awaitable } from 'discord.js';
|
|
1
|
+
import { Logger, type RecipleClientConfig } from '@reciple/core';
|
|
2
|
+
import type { Awaitable } from 'discord.js';
|
|
3
3
|
export interface RecipleConfig extends RecipleClientConfig {
|
|
4
4
|
logger?: {
|
|
5
5
|
enabled: boolean;
|
|
@@ -26,7 +26,17 @@ export interface RecipleConfigJS {
|
|
|
26
26
|
}
|
|
27
27
|
export declare class ConfigReader {
|
|
28
28
|
static defaultConfigFile: string;
|
|
29
|
+
/**
|
|
30
|
+
* Reads the default configuration data, processes it, and returns the resulting configuration string.
|
|
31
|
+
*
|
|
32
|
+
* @return {Promise<string>} The default configuration data as a string.
|
|
33
|
+
*/
|
|
29
34
|
static readDefaultConfig(): Promise<RecipleConfigJS>;
|
|
35
|
+
/**
|
|
36
|
+
* Reads the default configuration data, processes it, and returns the resulting configuration string.
|
|
37
|
+
*
|
|
38
|
+
* @return {Promise<string>} The default configuration data as a string.
|
|
39
|
+
*/
|
|
30
40
|
static getDefaultConfigData(): Promise<string>;
|
|
31
41
|
static readConfigJS(config: string | {
|
|
32
42
|
paths: string[];
|
|
@@ -36,5 +46,11 @@ export declare class ConfigReader {
|
|
|
36
46
|
paths: string[];
|
|
37
47
|
default?: string;
|
|
38
48
|
}, createIfNotExists?: false): Promise<RecipleConfigJS | null>;
|
|
49
|
+
/**
|
|
50
|
+
* Creates a configuration file if it doesn't exist and returns the file path.
|
|
51
|
+
*
|
|
52
|
+
* @param {string} file - The path to the configuration file.
|
|
53
|
+
* @return {Promise<string>} The path of the created or existing configuration file.
|
|
54
|
+
*/
|
|
39
55
|
static createConfigJS(file: string): Promise<string>;
|
|
40
56
|
}
|
package/dist/classes/Config.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RecipleError } from '@reciple/core';
|
|
1
|
+
import { Logger, RecipleError } from '@reciple/core';
|
|
2
2
|
import { recursiveDefaults, existsAsync } from '@reciple/utils';
|
|
3
3
|
import { mkdir, readFile, writeFile } from 'node:fs/promises';
|
|
4
4
|
import { kleur } from 'fallout-utility/strings';
|
|
@@ -7,15 +7,34 @@ import { fileURLToPath } from 'node:url';
|
|
|
7
7
|
import path from 'node:path';
|
|
8
8
|
export class ConfigReader {
|
|
9
9
|
static defaultConfigFile = path.join(path.dirname(fileURLToPath(import.meta.url)), '../../static/config.mjs');
|
|
10
|
+
/**
|
|
11
|
+
* Reads the default configuration data, processes it, and returns the resulting configuration string.
|
|
12
|
+
*
|
|
13
|
+
* @return {Promise<string>} The default configuration data as a string.
|
|
14
|
+
*/
|
|
10
15
|
static async readDefaultConfig() {
|
|
11
16
|
return recursiveDefaults(await import(this.defaultConfigFile));
|
|
12
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* Reads the default configuration data, processes it, and returns the resulting configuration string.
|
|
20
|
+
*
|
|
21
|
+
* @return {Promise<string>} The default configuration data as a string.
|
|
22
|
+
*/
|
|
13
23
|
static async getDefaultConfigData() {
|
|
14
24
|
let defaultConfig = (await readFile(this.defaultConfigFile, 'utf-8')).replaceAll('\r\n', '\n');
|
|
15
25
|
defaultConfig = defaultConfig.replace(`import { cliVersion } from 'reciple';\n`, '');
|
|
16
26
|
defaultConfig = defaultConfig.replace('version: `^${cliVersion}`', 'version: `^' + cliVersion + '`');
|
|
17
27
|
return defaultConfig;
|
|
18
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Reads a JavaScript configuration file and returns its contents as a `RecipleConfigJS` object.
|
|
31
|
+
* If the file does not exist, it can optionally create the file and return a default configuration.
|
|
32
|
+
*
|
|
33
|
+
* @param {string|{ paths: string[]; default?: string; }} config - The path to the configuration file or an object specifying multiple paths and a default path.
|
|
34
|
+
* @param {boolean} [createIfNotExists=true] - Whether to create the configuration file if it does not exist.
|
|
35
|
+
* @return {Promise<RecipleConfigJS|null>} A promise that resolves to the contents of the configuration file as a `RecipleConfigJS` object, or `null` if the file does not exist and `createIfNotExists` is `false`.
|
|
36
|
+
* @throws {RecipleError} If the configuration file does not contain valid data.
|
|
37
|
+
*/
|
|
19
38
|
static async readConfigJS(config, createIfNotExists = true) {
|
|
20
39
|
if (typeof config !== 'string') {
|
|
21
40
|
let data = null;
|
|
@@ -38,6 +57,12 @@ export class ConfigReader {
|
|
|
38
57
|
throw new RecipleError(`Invalid config data in ${kleur.yellow("'" + file) + "'"}`);
|
|
39
58
|
return data;
|
|
40
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* Creates a configuration file if it doesn't exist and returns the file path.
|
|
62
|
+
*
|
|
63
|
+
* @param {string} file - The path to the configuration file.
|
|
64
|
+
* @return {Promise<string>} The path of the created or existing configuration file.
|
|
65
|
+
*/
|
|
41
66
|
static async createConfigJS(file) {
|
|
42
67
|
if (await existsAsync(file))
|
|
43
68
|
return file;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Config.js","sourceRoot":"","sources":["../../src/classes/Config.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"Config.js","sourceRoot":"","sources":["../../src/classes/Config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAA4B,YAAY,EAAE,MAAM,eAAe,CAAC;AAC/E,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAChE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,IAAI,MAAM,WAAW,CAAC;AA4B7B,MAAM,OAAO,YAAY;IACd,MAAM,CAAC,iBAAiB,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,yBAAyB,CAAC,CAAC;IAErH;;;;OAIG;IACI,MAAM,CAAC,KAAK,CAAC,iBAAiB;QACjC,OAAO,iBAAiB,CAAk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,MAAM,IAAI,CAAC,MAAM,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC;YACrC,IAAI,CAAC,iBAAiB;gBAAE,OAAO,IAAI,CAAC;YACpC,MAAM,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;QACpC,CAAC;QAED,MAAM,IAAI,GAAG,iBAAiB,CAAkB,MAAM,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;QACpG,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC,QAAQ,IAAI,IAAI,CAAC;YAAE,MAAM,IAAI,YAAY,CAAC,0BAA0B,KAAK,CAAC,MAAM,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC,CAAC;QAErH,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC,IAAY;QAC3C,IAAI,MAAM,WAAW,CAAC,IAAI,CAAC;YAAE,OAAO,IAAI,CAAC;QAEzC,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,oBAAoB,EAAE,CAAC;QAExD,MAAM,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACrD,MAAM,SAAS,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;QAErC,OAAO,IAAI,CAAC;IAChB,CAAC"}
|
package/dist/exports.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exports.js","sourceRoot":"","sources":["../src/exports.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"exports.js","sourceRoot":"","sources":["../src/exports.ts"],"names":[],"mappings":"AACA,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { RecipleClient as Client } from '@reciple/core';
|
|
2
|
-
import { RecipleConfig } from './classes/Config.js';
|
|
2
|
+
import type { RecipleConfig } from './classes/Config.js';
|
|
3
3
|
export * from '@reciple/core';
|
|
4
4
|
export * from './exports.js';
|
|
5
5
|
export { config as loadEnv } from 'dotenv';
|
|
6
6
|
export declare class RecipleClient<Ready extends boolean = boolean> extends Client<Ready> {
|
|
7
7
|
readonly config: RecipleConfig;
|
|
8
8
|
}
|
|
9
|
+
declare global {
|
|
10
|
+
var reciple: RecipleClient;
|
|
11
|
+
}
|
package/dist/utils/cli.d.ts
CHANGED
package/dist/utils/cli.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { isMainThread, parentPort, threadId } from 'node:worker_threads';
|
|
2
|
+
import { PackageUpdateChecker } from '@reciple/utils';
|
|
2
3
|
import { buildVersion } from '@reciple/core';
|
|
3
4
|
import { fileURLToPath } from 'node:url';
|
|
4
5
|
import { readFileSync } from 'node:fs';
|
|
5
6
|
import { Command } from 'commander';
|
|
6
|
-
import path from 'node:path';
|
|
7
|
-
import { PackageUpdateChecker } from '@reciple/utils';
|
|
8
7
|
import { coerce } from 'semver';
|
|
8
|
+
import path from 'node:path';
|
|
9
9
|
const { version, description } = JSON.parse(readFileSync(path.join(path.dirname(fileURLToPath(import.meta.url)), '../../package.json'), 'utf-8'));
|
|
10
10
|
const originalCwd = process.cwd();
|
|
11
11
|
export let command = new Command()
|
package/dist/utils/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/utils/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,aAAa,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AI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,YAAY,CAAC;IAC9E;;OAEG;IACH,kBAAkB,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,CAAC;IACrF;;OAEG;IACH,OAAO,EAAE,SAA6B;CACzC,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;AAC/C,MAAM,CAAC,MAAM,eAAe,GAAG,OAAO,CAAC;AACvC,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,oBAAoB,CAAC;IAClD,QAAQ,EAAE;QACN,EAAE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,eAAe,EAAE;QACvD,EAAE,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,YAAY,EAAE;KAC7D;CACJ,CAAC,CAAC"}
|
package/dist/utils/logger.d.ts
CHANGED
|
@@ -1,10 +1,31 @@
|
|
|
1
|
-
import { Logger, LoggerLevel, PartialDeep } from 'fallout-utility';
|
|
2
|
-
import { RecipleConfig } from '../classes/Config.js';
|
|
1
|
+
import { Logger, LoggerLevel, type PartialDeep } from 'fallout-utility';
|
|
2
|
+
import type { RecipleConfig } from '../classes/Config.js';
|
|
3
3
|
import { type RecipleClient } from '../index.js';
|
|
4
|
+
/**
|
|
5
|
+
* Formats a log message with optional prefix, colored messages, and thread information.
|
|
6
|
+
*
|
|
7
|
+
* @param {string} message - The log message to format.
|
|
8
|
+
* @param {Logger} logger - The logger instance used to get the logger name.
|
|
9
|
+
* @param {PartialDeep<Exclude<RecipleConfig['logger'], Logger|undefined>> & { shards?: boolean; }} config - The logger configuration.
|
|
10
|
+
* @param {LoggerLevel} level - The log level.
|
|
11
|
+
* @return {string} The formatted log message.
|
|
12
|
+
*/
|
|
4
13
|
export declare function formatLogMessage(message: string, logger: Logger, config: PartialDeep<Exclude<RecipleConfig['logger'], Logger | undefined>> & {
|
|
5
14
|
shards?: boolean;
|
|
6
15
|
}, level: LoggerLevel): string;
|
|
16
|
+
/**
|
|
17
|
+
* Creates a logger with the specified configuration.
|
|
18
|
+
*
|
|
19
|
+
* @param {Omit<PartialDeep<Exclude<RecipleConfig['logger'], Logger|undefined>>, 'enabled'> & { shards?: boolean; }} config - The configuration for the logger.
|
|
20
|
+
* @return {Promise<Logger>} The created logger instance.
|
|
21
|
+
*/
|
|
7
22
|
export declare function createLogger(config?: Omit<PartialDeep<Exclude<RecipleConfig['logger'], Logger | undefined>>, 'enabled'> & {
|
|
8
23
|
shards?: boolean;
|
|
9
24
|
}): Promise<Logger>;
|
|
25
|
+
/**
|
|
26
|
+
* Adds event listeners to the client for various module events and reciple events.
|
|
27
|
+
*
|
|
28
|
+
* @param {RecipleClient} client - The client to add the event listeners to.
|
|
29
|
+
* @return {void} This function does not return anything.
|
|
30
|
+
*/
|
|
10
31
|
export declare function addEventListenersToClient(client: RecipleClient): void;
|
package/dist/utils/logger.js
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import { Logger, LoggerLevel, kleur } from 'fallout-utility';
|
|
2
|
+
import {} from '../index.js';
|
|
2
3
|
import { cli } from './cli.js';
|
|
3
4
|
import path from 'node:path';
|
|
5
|
+
/**
|
|
6
|
+
* Formats a log message with optional prefix, colored messages, and thread information.
|
|
7
|
+
*
|
|
8
|
+
* @param {string} message - The log message to format.
|
|
9
|
+
* @param {Logger} logger - The logger instance used to get the logger name.
|
|
10
|
+
* @param {PartialDeep<Exclude<RecipleConfig['logger'], Logger|undefined>> & { shards?: boolean; }} config - The logger configuration.
|
|
11
|
+
* @param {LoggerLevel} level - The log level.
|
|
12
|
+
* @return {string} The formatted log message.
|
|
13
|
+
*/
|
|
4
14
|
export function formatLogMessage(message, logger, config, level) {
|
|
5
15
|
const color = (msg) => {
|
|
6
16
|
if (!config.coloredMessages || level === LoggerLevel.INFO)
|
|
@@ -22,6 +32,12 @@ export function formatLogMessage(message, logger, config, level) {
|
|
|
22
32
|
(logger.name ? `[${logger.name}]` : ''))
|
|
23
33
|
: '') + ` ${message}`;
|
|
24
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* Creates a logger with the specified configuration.
|
|
37
|
+
*
|
|
38
|
+
* @param {Omit<PartialDeep<Exclude<RecipleConfig['logger'], Logger|undefined>>, 'enabled'> & { shards?: boolean; }} config - The configuration for the logger.
|
|
39
|
+
* @return {Promise<Logger>} The created logger instance.
|
|
40
|
+
*/
|
|
25
41
|
export async function createLogger(config) {
|
|
26
42
|
const logger = new Logger({
|
|
27
43
|
enableDebugmode: (cli.options.debugmode || config?.debugmode) ?? null,
|
|
@@ -40,6 +56,12 @@ export async function createLogger(config) {
|
|
|
40
56
|
}
|
|
41
57
|
return logger;
|
|
42
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* Adds event listeners to the client for various module events and reciple events.
|
|
61
|
+
*
|
|
62
|
+
* @param {RecipleClient} client - The client to add the event listeners to.
|
|
63
|
+
* @return {void} This function does not return anything.
|
|
64
|
+
*/
|
|
43
65
|
export function addEventListenersToClient(client) {
|
|
44
66
|
client.on('recipleDebug', debug => client.logger?.debug(debug));
|
|
45
67
|
client.modules.on('resolveModuleFileError', (file, error) => client.logger?.err(`Failed to resolve module ${kleur.yellow(quoteString(file))}:`, error));
|
package/dist/utils/logger.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,KAAK,EAAoB,MAAM,iBAAiB,CAAC;AAE/E,O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,EAAE,KAAK,CAAC,2BAA2B,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;IAEtJ,MAAM,CAAC,EAAE,CAAC,oCAAoC,EAAE,CAAC,QAAQ,EAAE,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,eAAe,QAAQ,EAAE,IAAI,IAAI,CAAC,0BAA0B,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;AAC/L,CAAC;AAED,SAAS,WAAW,CAAC,MAAc,EAAE,QAAgB,GAAG;IACpD,OAAO,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,EAAE,CAAC;AACvC,CAAC"}
|
package/dist/utils/modules.d.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
-
import { RecipleConfig } from '../classes/Config.js';
|
|
2
|
-
import { Awaitable } from 'fallout-utility/types';
|
|
1
|
+
import type { RecipleConfig } from '../classes/Config.js';
|
|
2
|
+
import type { Awaitable } from 'fallout-utility/types';
|
|
3
|
+
/**
|
|
4
|
+
* Recursively finds modules in specified directories based on the given configuration.
|
|
5
|
+
*
|
|
6
|
+
* @param {RecipleConfig['modules']} config - The configuration object containing directories and filters.
|
|
7
|
+
* @param {((filename: string) => Awaitable<boolean>)?} filter - An optional function to filter files.
|
|
8
|
+
* @return {Promise<string[]>} A promise that resolves to an array of module file paths.
|
|
9
|
+
*/
|
|
3
10
|
export declare function findModules(config: RecipleConfig['modules'], filter?: (filename: string) => Awaitable<boolean>): Promise<string[]>;
|
package/dist/utils/modules.js
CHANGED
|
@@ -2,6 +2,13 @@ import { lstat, mkdir, readdir } from 'node:fs/promises';
|
|
|
2
2
|
import { existsAsync } from '@reciple/utils';
|
|
3
3
|
import micromatch from 'micromatch';
|
|
4
4
|
import path from 'node:path';
|
|
5
|
+
/**
|
|
6
|
+
* Recursively finds modules in specified directories based on the given configuration.
|
|
7
|
+
*
|
|
8
|
+
* @param {RecipleConfig['modules']} config - The configuration object containing directories and filters.
|
|
9
|
+
* @param {((filename: string) => Awaitable<boolean>)?} filter - An optional function to filter files.
|
|
10
|
+
* @return {Promise<string[]>} A promise that resolves to an array of module file paths.
|
|
11
|
+
*/
|
|
5
12
|
export async function findModules(config, filter) {
|
|
6
13
|
const modules = [];
|
|
7
14
|
const { globby, isDynamicPattern } = await import('globby');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modules.js","sourceRoot":"","sources":["../../src/utils/modules.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"modules.js","sourceRoot":"","sources":["../../src/utils/modules.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAEzD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,MAAgC,EAAE,MAAiD;IACjH,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,CAAC;IAE5D,KAAK,MAAM,MAAM,IAAI,MAAM,EAAE,IAAI,IAAI,EAAE,EAAE,CAAC;QACtC,MAAM,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,MAAM,CAAC,CAAC;QAEhF,IAAI,gBAAgB,CAAC,MAAM,EAAE,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,EAAE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AC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAEpE,MAAM,OAAO,GAAG,KAAK,EAAE,IAAY,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,MAAM,IAAI,MAAM,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAE/H,MAAM,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAClD,CAAC;IAED,OAAO,OAAO,CAAC;AACnB,CAAC"}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Reciple is a Discord.js bot framework",
|
|
4
4
|
"homepage": "https://reciple.js.org/docs/reciple",
|
|
5
5
|
"license": "GPL-3.0",
|
|
6
|
-
"version": "9.
|
|
6
|
+
"version": "9.2.0",
|
|
7
7
|
"module": "./dist/index.js",
|
|
8
8
|
"types": "./dist/index.d.ts",
|
|
9
9
|
"bin": "./dist/bin.js",
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"scripts": {
|
|
33
33
|
"clean": "rimraf ./dist",
|
|
34
34
|
"build": "npm run clean && tsc",
|
|
35
|
+
"check": "tsc --noEmit",
|
|
35
36
|
"docs": "node ../docgen/dist/bin.js -i ./src/exports.ts -o ./docs/docs.json"
|
|
36
37
|
},
|
|
37
38
|
"files": [
|
|
@@ -40,7 +41,7 @@
|
|
|
40
41
|
"README.md"
|
|
41
42
|
],
|
|
42
43
|
"dependencies": {
|
|
43
|
-
"@reciple/utils": "^9.
|
|
44
|
+
"@reciple/utils": "^9.2.0",
|
|
44
45
|
"commander": "^12.1.0",
|
|
45
46
|
"dotenv": "^16.4.5",
|
|
46
47
|
"fallout-utility": "^2.9.1",
|
|
@@ -50,7 +51,7 @@
|
|
|
50
51
|
"semver": "^7.6.2"
|
|
51
52
|
},
|
|
52
53
|
"devDependencies": {
|
|
53
|
-
"@reciple/core": "^9.
|
|
54
|
+
"@reciple/core": "^9.2.0",
|
|
54
55
|
"@types/micromatch": "^4.0.7",
|
|
55
56
|
"@types/semver": "^7.5.8",
|
|
56
57
|
"discord.js": "^14.15.3"
|
|
@@ -59,5 +60,5 @@
|
|
|
59
60
|
"@reciple/core": "^9 || ^9.0.0-dev",
|
|
60
61
|
"discord.js": "^14.15.0"
|
|
61
62
|
},
|
|
62
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "1b165aa7367960c9db0267ba9f8982b8b8e2a002"
|
|
63
64
|
}
|
package/static/config.mjs
CHANGED
|
@@ -1,79 +1,79 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
import { CooldownPrecondition, CommandPermissionsPrecondition } from 'reciple';
|
|
3
|
-
import { IntentsBitField } from 'discord.js';
|
|
4
|
-
import { cliVersion } from 'reciple';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @satisfies {import('reciple').RecipleConfig}
|
|
8
|
-
*/
|
|
9
|
-
export const config = {
|
|
10
|
-
token: process.env.TOKEN ?? '',
|
|
11
|
-
commands: {
|
|
12
|
-
contextMenuCommand: {
|
|
13
|
-
enabled: true,
|
|
14
|
-
enableCooldown: true,
|
|
15
|
-
acceptRepliedInteractions: false,
|
|
16
|
-
registerCommands: {
|
|
17
|
-
registerGlobally: true,
|
|
18
|
-
registerToGuilds: []
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
messageCommand: {
|
|
22
|
-
enabled: true,
|
|
23
|
-
enableCooldown: true,
|
|
24
|
-
commandArgumentSeparator: ' ',
|
|
25
|
-
prefix: '!'
|
|
26
|
-
},
|
|
27
|
-
slashCommand: {
|
|
28
|
-
enabled: true,
|
|
29
|
-
enableCooldown: true,
|
|
30
|
-
acceptRepliedInteractions: false,
|
|
31
|
-
registerCommands: {
|
|
32
|
-
registerGlobally: true,
|
|
33
|
-
registerToGuilds: []
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
applicationCommandRegister: {
|
|
38
|
-
enabled: true,
|
|
39
|
-
allowRegisterGlobally: true,
|
|
40
|
-
allowRegisterToGuilds: true,
|
|
41
|
-
registerEmptyCommands: true,
|
|
42
|
-
registerToGuilds: []
|
|
43
|
-
},
|
|
44
|
-
client: {
|
|
45
|
-
intents: [
|
|
46
|
-
IntentsBitField.Flags.Guilds,
|
|
47
|
-
IntentsBitField.Flags.GuildMembers,
|
|
48
|
-
IntentsBitField.Flags.GuildMessages,
|
|
49
|
-
IntentsBitField.Flags.MessageContent,
|
|
50
|
-
]
|
|
51
|
-
},
|
|
52
|
-
logger: {
|
|
53
|
-
enabled: true,
|
|
54
|
-
debugmode: null,
|
|
55
|
-
coloredMessages: true,
|
|
56
|
-
disableLogPrefix: false,
|
|
57
|
-
logToFile: {
|
|
58
|
-
enabled: true,
|
|
59
|
-
logsFolder: './logs',
|
|
60
|
-
file: 'latest.log'
|
|
61
|
-
}
|
|
62
|
-
},
|
|
63
|
-
modules: {
|
|
64
|
-
dirs: ['./modules'],
|
|
65
|
-
exclude: [],
|
|
66
|
-
filter: file => true,
|
|
67
|
-
disableModuleVersionCheck: false
|
|
68
|
-
},
|
|
69
|
-
preconditions: [
|
|
70
|
-
new CooldownPrecondition(),
|
|
71
|
-
new CommandPermissionsPrecondition()
|
|
72
|
-
],
|
|
73
|
-
commandHalts: [],
|
|
74
|
-
cooldownSweeperOptions: {
|
|
75
|
-
timer: 1000 * 60 * 60
|
|
76
|
-
},
|
|
77
|
-
checkForUpdates: true,
|
|
78
|
-
version: `^${cliVersion}`
|
|
79
|
-
};
|
|
1
|
+
// @ts-check
|
|
2
|
+
import { CooldownPrecondition, CommandPermissionsPrecondition } from 'reciple';
|
|
3
|
+
import { IntentsBitField } from 'discord.js';
|
|
4
|
+
import { cliVersion } from 'reciple';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @satisfies {import('reciple').RecipleConfig}
|
|
8
|
+
*/
|
|
9
|
+
export const config = {
|
|
10
|
+
token: process.env.TOKEN ?? '',
|
|
11
|
+
commands: {
|
|
12
|
+
contextMenuCommand: {
|
|
13
|
+
enabled: true,
|
|
14
|
+
enableCooldown: true,
|
|
15
|
+
acceptRepliedInteractions: false,
|
|
16
|
+
registerCommands: {
|
|
17
|
+
registerGlobally: true,
|
|
18
|
+
registerToGuilds: []
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
messageCommand: {
|
|
22
|
+
enabled: true,
|
|
23
|
+
enableCooldown: true,
|
|
24
|
+
commandArgumentSeparator: ' ',
|
|
25
|
+
prefix: '!'
|
|
26
|
+
},
|
|
27
|
+
slashCommand: {
|
|
28
|
+
enabled: true,
|
|
29
|
+
enableCooldown: true,
|
|
30
|
+
acceptRepliedInteractions: false,
|
|
31
|
+
registerCommands: {
|
|
32
|
+
registerGlobally: true,
|
|
33
|
+
registerToGuilds: []
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
applicationCommandRegister: {
|
|
38
|
+
enabled: true,
|
|
39
|
+
allowRegisterGlobally: true,
|
|
40
|
+
allowRegisterToGuilds: true,
|
|
41
|
+
registerEmptyCommands: true,
|
|
42
|
+
registerToGuilds: []
|
|
43
|
+
},
|
|
44
|
+
client: {
|
|
45
|
+
intents: [
|
|
46
|
+
IntentsBitField.Flags.Guilds,
|
|
47
|
+
IntentsBitField.Flags.GuildMembers,
|
|
48
|
+
IntentsBitField.Flags.GuildMessages,
|
|
49
|
+
IntentsBitField.Flags.MessageContent,
|
|
50
|
+
]
|
|
51
|
+
},
|
|
52
|
+
logger: {
|
|
53
|
+
enabled: true,
|
|
54
|
+
debugmode: null,
|
|
55
|
+
coloredMessages: true,
|
|
56
|
+
disableLogPrefix: false,
|
|
57
|
+
logToFile: {
|
|
58
|
+
enabled: true,
|
|
59
|
+
logsFolder: './logs',
|
|
60
|
+
file: 'latest.log'
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
modules: {
|
|
64
|
+
dirs: ['./modules', './modules/*', './modules/*/*'],
|
|
65
|
+
exclude: ['halts', 'preconditions', '_*'],
|
|
66
|
+
filter: file => true,
|
|
67
|
+
disableModuleVersionCheck: false
|
|
68
|
+
},
|
|
69
|
+
preconditions: [
|
|
70
|
+
new CooldownPrecondition(),
|
|
71
|
+
new CommandPermissionsPrecondition()
|
|
72
|
+
],
|
|
73
|
+
commandHalts: [],
|
|
74
|
+
cooldownSweeperOptions: {
|
|
75
|
+
timer: 1000 * 60 * 60
|
|
76
|
+
},
|
|
77
|
+
checkForUpdates: true,
|
|
78
|
+
version: `^${cliVersion}`
|
|
79
|
+
};
|