create-reciple 8.0.3 → 8.0.4
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/assets/README.md +190 -0
- package/package.json +3 -3
package/assets/README.md
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
# Reciple App
|
|
2
|
+
|
|
3
|
+
Reciple is a Discord.js command handler framework that just works :3
|
|
4
|
+
|
|
5
|
+
> This application is generated by [`create-reciple`](https://npm.im/create-reciple).
|
|
6
|
+
|
|
7
|
+
## Configuration
|
|
8
|
+
|
|
9
|
+
Configuration file is set to `./reciple.mjs` or `./reciple.cjs` by default on the CLI.
|
|
10
|
+
|
|
11
|
+
> To change the config path, simply add the `-c, --config <path>` flag
|
|
12
|
+
|
|
13
|
+
## Module System
|
|
14
|
+
|
|
15
|
+
With Reciple a module can be a command, event, or anything. Reciple scans the dirs given from the config and loads every valid javascript files in that folder.
|
|
16
|
+
|
|
17
|
+
### File Structure
|
|
18
|
+
|
|
19
|
+
```js
|
|
20
|
+
// Module config (reciple.mjs)
|
|
21
|
+
export const config = {
|
|
22
|
+
// other things
|
|
23
|
+
modules: {
|
|
24
|
+
dirs: ['./modules'], // scans the modules folder
|
|
25
|
+
exclude: [],
|
|
26
|
+
filter: file => true,
|
|
27
|
+
disableModuleVersionCheck: false
|
|
28
|
+
},
|
|
29
|
+
// other things
|
|
30
|
+
};
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
> Folder structure
|
|
35
|
+
|
|
36
|
+
reciple.mjs
|
|
37
|
+
package.json
|
|
38
|
+
node_modules/
|
|
39
|
+
modules/
|
|
40
|
+
├─ module1.js
|
|
41
|
+
├─ module2.js
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
You can also use a glob pattern for your dir config.
|
|
45
|
+
|
|
46
|
+
```js
|
|
47
|
+
// Module config (reciple.mjs)
|
|
48
|
+
export const config = {
|
|
49
|
+
// other things
|
|
50
|
+
modules: {
|
|
51
|
+
dirs: ['./modules/**/*'], // scans the modules folder and every folders in it recursively
|
|
52
|
+
exclude: [],
|
|
53
|
+
filter: file => true,
|
|
54
|
+
disableModuleVersionCheck: false
|
|
55
|
+
},
|
|
56
|
+
// other things
|
|
57
|
+
};
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
> Folder structure
|
|
62
|
+
|
|
63
|
+
reciple.mjs
|
|
64
|
+
package.json
|
|
65
|
+
node_modules/
|
|
66
|
+
modules/
|
|
67
|
+
├─ module1.js
|
|
68
|
+
├─ module2.js
|
|
69
|
+
├─anotherFolder/
|
|
70
|
+
├─ module1.js
|
|
71
|
+
├─ module2.js
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Module Structure
|
|
75
|
+
|
|
76
|
+
Reciple can load CommonJs and ESM modules at the same time.
|
|
77
|
+
|
|
78
|
+
#### Valid File Types
|
|
79
|
+
- `.js`
|
|
80
|
+
- `.cjs`
|
|
81
|
+
- `.mjs`
|
|
82
|
+
|
|
83
|
+
#### Module Files
|
|
84
|
+
|
|
85
|
+
```js
|
|
86
|
+
// ESM
|
|
87
|
+
export default {
|
|
88
|
+
versions: ['^8'],
|
|
89
|
+
onStart: async ({ client }) => true, // Always return true if the module is loaded
|
|
90
|
+
onLoad: async ({ client }) => {},
|
|
91
|
+
onUnload: async ({ client }) => {}
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
// CJS
|
|
95
|
+
module.exports = {
|
|
96
|
+
versions: ['^8'],
|
|
97
|
+
onStart: async ({ client }) => true, // Always return true if the module is loaded
|
|
98
|
+
onLoad: async ({ client }) => {},
|
|
99
|
+
onUnload: async ({ client }) => {}
|
|
100
|
+
};
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
**Modules Using Classes**
|
|
104
|
+
```js
|
|
105
|
+
|
|
106
|
+
// ESM
|
|
107
|
+
export class MyModule {
|
|
108
|
+
versions = ['^8'];
|
|
109
|
+
|
|
110
|
+
async onStart({ client }) {
|
|
111
|
+
return true; // Always return true if the module is loaded
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
async onLoad({ client }) {}
|
|
115
|
+
async onUnload({ client }) {}
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
export default new MyModule();
|
|
119
|
+
|
|
120
|
+
// CJS
|
|
121
|
+
class MyModule {
|
|
122
|
+
versions = ['^8'];
|
|
123
|
+
|
|
124
|
+
async onStart({ client }) {
|
|
125
|
+
return true; // Always return true if the module is loaded
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
async onLoad({ client }) {}
|
|
129
|
+
async onUnload({ client }) {}
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
module.exports = new MyModule();
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Adding Commands
|
|
136
|
+
|
|
137
|
+
To add commands to your module, simply add `commands` propery to your module.
|
|
138
|
+
|
|
139
|
+
```js
|
|
140
|
+
export default {
|
|
141
|
+
versions: ['^8'],
|
|
142
|
+
commands: [], // Commands goes here
|
|
143
|
+
onStart: async ({ client }) => true, // Always return true if the module is loaded
|
|
144
|
+
onLoad: async ({ client }) => {},
|
|
145
|
+
onUnload: async ({ client }) => {}
|
|
146
|
+
};
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Instead of importing command builders from Discord.js, use the command builders provided by Reciple.
|
|
150
|
+
|
|
151
|
+
```diff
|
|
152
|
+
// ESM
|
|
153
|
+
- import { ContextMenuCommandBuilder, SlashCommandBuilder } from 'discord.js';
|
|
154
|
+
+ import { ContextMenuCommandBuilder, SlashCommandBuilder } from 'reciple';
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
```diff
|
|
158
|
+
// CJS
|
|
159
|
+
- const { ContextMenuCommandBuilder, SlashCommandBuilder } = require('discord.js');
|
|
160
|
+
+ const { ContextMenuCommandBuilder, SlashCommandBuilder } = require('reciple');
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
Just create a new instance of a command builder in the commands array to add commands to a module.
|
|
164
|
+
|
|
165
|
+
```js
|
|
166
|
+
import { ContextMenuCommandBuilder, MessageCommandBuilder, SlashCommandBuilder } from 'reciple';
|
|
167
|
+
|
|
168
|
+
export default {
|
|
169
|
+
versions: ['^8'],
|
|
170
|
+
commands: [
|
|
171
|
+
new ContextMenuCommandBuilder()
|
|
172
|
+
.setName('To Lowercase')
|
|
173
|
+
.setType('Message')
|
|
174
|
+
.setExecute(async ({ interaction }) => interaction.reply(interaction.targetMessage.content.toLowercase())),
|
|
175
|
+
new MessageCommandBuilder()
|
|
176
|
+
.setName('hi')
|
|
177
|
+
.setDescript('Say hello')
|
|
178
|
+
.setExecute(async ({ message }) => message.reply('hello')),
|
|
179
|
+
new SlashCommandBuilder()
|
|
180
|
+
.setName('hello')
|
|
181
|
+
.setDescript('Say hi')
|
|
182
|
+
.setExecute(async ({ interaction }) => interaction.reply('hi'))
|
|
183
|
+
],
|
|
184
|
+
onStart: async ({ client }) => true, // Always return true if the module is loaded
|
|
185
|
+
onLoad: async ({ client }) => {},
|
|
186
|
+
onUnload: async ({ client }) => {}
|
|
187
|
+
};
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
[**Read The Docs**](https://reciple.js.org/docs)
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "create-reciple",
|
|
3
3
|
"description": "A Reciple Discord bot project builder",
|
|
4
4
|
"license": "GPL-3.0",
|
|
5
|
-
"version": "8.0.
|
|
5
|
+
"version": "8.0.4",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
8
8
|
"module": "./dist/index.js",
|
|
@@ -40,9 +40,9 @@
|
|
|
40
40
|
"@types/node": "^20.8.7",
|
|
41
41
|
"discord.js": "^14.13.0",
|
|
42
42
|
"nodemon": "^3.0.1",
|
|
43
|
-
"reciple": "^8.0.
|
|
43
|
+
"reciple": "^8.0.4",
|
|
44
44
|
"rimraf": "^5.0.5",
|
|
45
45
|
"typescript": "^5.2.2"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "bec85a76e2bd5215025be37ff1cc18caedc328f0"
|
|
48
48
|
}
|