create-reciple 7.11.14 → 7.11.15

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 CHANGED
@@ -1,38 +1,38 @@
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://discord.gg/VzP8qW7Z8d">
8
- <img src="https://img.shields.io/discord/993105237000855592?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/FalloutStudios/Reciple/blob/main/LICENSE">
14
- <img src="https://img.shields.io/npm/dt/reciple.svg?maxAge=3600">
15
- </a>
16
- <a href="https://www.codefactor.io/repository/github/falloutstudios/reciple/overview/main">
17
- <img src="https://www.codefactor.io/repository/github/falloutstudios/reciple/badge/main">
18
- </a>
19
- </h3>
20
-
21
- ## About
22
-
23
- `create-reciple` is a tool used to easily create Reciple projects.
24
-
25
- ## Installation
26
-
27
- ```bash
28
- npm create reciple@latest
29
- yarn create reciple@latest
30
- pnpm create reciple@latest
31
- ```
32
-
33
- ## Templates
34
- - Javascript (CommonJS)
35
- - Javascript (ES Modules)
36
- - Typescript (CommonJS)
37
- - Typescript (ES Modules)
38
-
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://discord.gg/VzP8qW7Z8d">
8
+ <img src="https://img.shields.io/discord/993105237000855592?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/FalloutStudios/Reciple/blob/main/LICENSE">
14
+ <img src="https://img.shields.io/npm/dt/reciple.svg?maxAge=3600">
15
+ </a>
16
+ <a href="https://www.codefactor.io/repository/github/falloutstudios/reciple/overview/main">
17
+ <img src="https://www.codefactor.io/repository/github/falloutstudios/reciple/badge/main">
18
+ </a>
19
+ </h3>
20
+
21
+ ## About
22
+
23
+ `create-reciple` is a tool used to easily create Reciple projects.
24
+
25
+ ## Installation
26
+
27
+ ```bash
28
+ npm create reciple@latest
29
+ yarn create reciple@latest
30
+ pnpm create reciple@latest
31
+ ```
32
+
33
+ ## Templates
34
+ - Javascript (CommonJS)
35
+ - Javascript (ES Modules)
36
+ - Typescript (CommonJS)
37
+ - Typescript (ES Modules)
38
+
package/assets/README.md CHANGED
@@ -1,257 +1,257 @@
1
- ## Reciple App
2
-
3
- This application is generated from [`create-reciple`](https://npm.im/create-reciple) templates. Reciple is a [Discord.js](https://discord.js.org) command handler framework that just works.
4
-
5
- ## Reciple Modules
6
-
7
- - Reciple scans the directory assigned in `reciple.yml` under `modules.modulesFolders` property.
8
- - `modules.modulesFolders` can be the path of the folder of modules or glob pattern
9
-
10
- ### Folder Structure
11
-
12
- ##### Example Structure
13
- ```yml
14
- # Modules config
15
-
16
- modules:
17
- modulesFolders:
18
- - './modules' # Scans the modules folder for module files
19
- ```
20
-
21
- ```
22
- # Dir structure
23
-
24
- modules/
25
- ├─ Module1.js
26
- ├─ Module2.js
27
- ```
28
-
29
- ##### Example Structure with Glob patterns
30
- ```yml
31
- # Modules config
32
-
33
- modules:
34
- modulesFolders:
35
- - './modules' # Scans the modules folder for module files
36
- - './modules/*' # Scans the folders of modules folder for module files
37
- ```
38
-
39
- ```
40
- # Dir structure
41
-
42
- modules/
43
- ├─ moreModules/
44
- │ ├─ Module1.js
45
- │ ├─ Module2.js
46
- ├─ Module3.js
47
- ├─ Module4.js
48
- ```
49
-
50
- ### Module Structure
51
-
52
- Module files can be ES Modules or CommonJs.
53
-
54
- ##### Supported module file types
55
-
56
- - `.js` *This can be an ESM or CJS*
57
- - `.mjs`
58
- - `.cjs`
59
-
60
- #### Module file structure
61
-
62
- - [RecipleModuleScript](https://reciple.js.org/docs/client/main/typedefs/RecipleModuleScript)
63
-
64
- #### ESM module example
65
-
66
- ```js
67
- // Usage without classes
68
-
69
- export default {
70
- versions: '^7',
71
- onStart: async client => {
72
- return true;
73
- },
74
- onLoad: async client => {},
75
- onUnload: async ({ client }) => {}
76
- };
77
- ```
78
- ```js
79
- // Usage with classes
80
-
81
- export class MyModule {
82
- versions = '^7';
83
- commands = [];
84
-
85
- async onStart(client) {
86
- return true;
87
- }
88
-
89
- async onLoad(client) {}
90
- async onUnload(unloadData) {}
91
- }
92
-
93
- export default new MyModule();
94
- ```
95
-
96
- #### CommonJS module example
97
-
98
- ```js
99
- // Usage without classes
100
-
101
- module.exports = {
102
- versions: '^7',
103
- onStart: async client => {
104
- return true;
105
- },
106
- onLoad: async client => {},
107
- onUnload: async ({ client }) => {}
108
- };
109
- ```
110
- ```js
111
- // Usage with classes
112
-
113
- class MyModule {
114
- versions = '^7';
115
- commands = [];
116
-
117
- async onStart(client) {
118
- return true;
119
- }
120
-
121
- async onLoad(client) {}
122
- async onUnload(unloadData) {}
123
- }
124
-
125
- module.exports = new MyModule();
126
- ```
127
-
128
- ## Reciple Commands
129
-
130
- instead of importing builders from `discord.js`, import command builders from `reciple` or `@reciple/client`.
131
-
132
- ```diff
133
- - const { SlashCommandBuilder, ContextMenuCommandBuilder } = require('discord.js');
134
- - import { SlashCommandBuilder, ContextMenuCommandBuilder } from 'discord.js';
135
- + const { SlashCommandBuilder, ContextMenuCommandBuilder } = require('reciple');
136
- + import { SlashCommandBuilder, ContextMenuCommandBuilder } from 'reciple';
137
- ```
138
-
139
- You can add your commands in the commands property of your module script.
140
-
141
- ```js
142
- export default {
143
- versions: '^7',
144
- commands: [
145
- new SlashCommandBuilder()
146
- .setName('ping')
147
- .setDescription('Just a ping command')
148
- .setExecute(async ({ interaction }) => {
149
- await interaction.reply('Pong');
150
- })
151
- ],
152
- onStart: async client => {
153
- return true;
154
- }
155
- };
156
- ```
157
-
158
- ### Interaction command execute params
159
-
160
- - [ContextMenuCommandExecuteData](https://reciple.js.org/docs/client/main/typedefs/ContextMenuCommandExecuteData)
161
- - [SlashCommandExecuteData](https://reciple.js.org/docs/client/main/typedefs/SlashCommandExecuteData)
162
-
163
- ### Message command execute params
164
-
165
- - [MessageCommandExecuteData](https://reciple.js.org/docs/client/main/typedefs/MessageCommandExecuteData)
166
-
167
- ### Handling command execute errors
168
-
169
- Command halt function can handle command cooldown and errors. Return `true` if the error or cooldown is handled.
170
-
171
- ```js
172
- new SlashCommandBuilder()
173
- .setName('ping')
174
- .setDescription('Just a ping command')
175
- .setExecute(async ({ interaction }) => {
176
- await interaction.reply('Pong');
177
- })
178
- .setHalt(async haltData => {
179
- switch (haltData.reason) {
180
- case CommandHaltReason.Cooldown:
181
- await haltData.executeData.interaction.followUp(`You've been cooled-down`);
182
- return true;
183
- case CommandHaltReason.Error:
184
- await haltData.executeData.interaction.followUp('An error occured');
185
- return true;
186
- }
187
-
188
- // The rest is unhandled
189
- })
190
- ```
191
-
192
- ### Using command preconditions
193
-
194
- Command preconditions are executed after the command is received and before executing the command's execute function.
195
-
196
- #### Module command preconditions
197
-
198
- You can define a precondition for all commands of a module.
199
-
200
- ##### Valid module precondition methods
201
-
202
- - [Context meny command preconditions](https://reciple.js.org/docs/client/main/typedefs/RecipleModuleScript#contextMenuCommandPrecondition)
203
- - [Message command preconditions](https://reciple.js.org/docs/client/main/typedefs/RecipleModuleScript#messageCommandPrecondition)
204
- - [Slash command preconditions](https://reciple.js.org/docs/client/main/typedefs/RecipleModuleScript#slashCommandPrecondition)
205
-
206
- ```js
207
- // Example module with slash commands precondition
208
- export default {
209
- versions: '^7',
210
- commands: [
211
- new SlashCommandBuilder()
212
- .setName('ping')
213
- .setDescription('Just a ping command')
214
- .setExecute(async ({ interaction }) => {
215
- await interaction.reply('Pong');
216
- })
217
- ],
218
- onStart: async client => true,
219
-
220
- // creates a slash command precondition
221
- slashCommandPrecondition: async (({ interaction })) => {
222
- return !interaction.inCachedGuild() || interaction.guild.ownerId !== interaction.user.id; // Command can only be executed by the guild owner
223
- }
224
- };
225
- ```
226
-
227
- #### Global command preconditions
228
-
229
- Global preconditions are added to all commands along with the existing module preconditions.
230
-
231
- ##### Set & Get global preconditions
232
- - [CommandManager#setGlobalPrecondition](https://reciple.js.org/docs/client/main/classes/CommandManager#setGlobalPrecondition)
233
- - [CommandManager#getGlobalPrecondition](https://reciple.js.org/docs/client/main/classes/CommandManager#getGlobalPrecondition)
234
-
235
- ```js
236
- // Example module with global slash commands precondition
237
- export default {
238
- versions: '^7',
239
- commands: [
240
- new SlashCommandBuilder()
241
- .setName('ping')
242
- .setDescription('Just a ping command')
243
- .setExecute(async ({ interaction }) => {
244
- await interaction.reply('Pong');
245
- })
246
- ],
247
- onStart: async client => true,
248
- onLoad: async client => {
249
- client.commands.setGlobalPrecondition(
250
- CommandType.SlashCommand,
251
- async ({ interaction }) => {
252
- return interaction.inCachedGuild(); // All slash commands can only be executed if in cached guild
253
- }
254
- );
255
- }
256
- };
257
- ```
1
+ ## Reciple App
2
+
3
+ This application is generated from [`create-reciple`](https://npm.im/create-reciple) templates. Reciple is a [Discord.js](https://discord.js.org) command handler framework that just works.
4
+
5
+ ## Reciple Modules
6
+
7
+ - Reciple scans the directory assigned in `reciple.yml` under `modules.modulesFolders` property.
8
+ - `modules.modulesFolders` can be the path of the folder of modules or glob pattern
9
+
10
+ ### Folder Structure
11
+
12
+ ##### Example Structure
13
+ ```yml
14
+ # Modules config
15
+
16
+ modules:
17
+ modulesFolders:
18
+ - './modules' # Scans the modules folder for module files
19
+ ```
20
+
21
+ ```
22
+ # Dir structure
23
+
24
+ modules/
25
+ ├─ Module1.js
26
+ ├─ Module2.js
27
+ ```
28
+
29
+ ##### Example Structure with Glob patterns
30
+ ```yml
31
+ # Modules config
32
+
33
+ modules:
34
+ modulesFolders:
35
+ - './modules' # Scans the modules folder for module files
36
+ - './modules/*' # Scans the folders of modules folder for module files
37
+ ```
38
+
39
+ ```
40
+ # Dir structure
41
+
42
+ modules/
43
+ ├─ moreModules/
44
+ │ ├─ Module1.js
45
+ │ ├─ Module2.js
46
+ ├─ Module3.js
47
+ ├─ Module4.js
48
+ ```
49
+
50
+ ### Module Structure
51
+
52
+ Module files can be ES Modules or CommonJs.
53
+
54
+ ##### Supported module file types
55
+
56
+ - `.js` *This can be an ESM or CJS*
57
+ - `.mjs`
58
+ - `.cjs`
59
+
60
+ #### Module file structure
61
+
62
+ - [RecipleModuleScript](https://reciple.js.org/docs/client/main/typedefs/RecipleModuleScript)
63
+
64
+ #### ESM module example
65
+
66
+ ```js
67
+ // Usage without classes
68
+
69
+ export default {
70
+ versions: '^7',
71
+ onStart: async client => {
72
+ return true;
73
+ },
74
+ onLoad: async client => {},
75
+ onUnload: async ({ client }) => {}
76
+ };
77
+ ```
78
+ ```js
79
+ // Usage with classes
80
+
81
+ export class MyModule {
82
+ versions = '^7';
83
+ commands = [];
84
+
85
+ async onStart(client) {
86
+ return true;
87
+ }
88
+
89
+ async onLoad(client) {}
90
+ async onUnload(unloadData) {}
91
+ }
92
+
93
+ export default new MyModule();
94
+ ```
95
+
96
+ #### CommonJS module example
97
+
98
+ ```js
99
+ // Usage without classes
100
+
101
+ module.exports = {
102
+ versions: '^7',
103
+ onStart: async client => {
104
+ return true;
105
+ },
106
+ onLoad: async client => {},
107
+ onUnload: async ({ client }) => {}
108
+ };
109
+ ```
110
+ ```js
111
+ // Usage with classes
112
+
113
+ class MyModule {
114
+ versions = '^7';
115
+ commands = [];
116
+
117
+ async onStart(client) {
118
+ return true;
119
+ }
120
+
121
+ async onLoad(client) {}
122
+ async onUnload(unloadData) {}
123
+ }
124
+
125
+ module.exports = new MyModule();
126
+ ```
127
+
128
+ ## Reciple Commands
129
+
130
+ instead of importing builders from `discord.js`, import command builders from `reciple` or `@reciple/client`.
131
+
132
+ ```diff
133
+ - const { SlashCommandBuilder, ContextMenuCommandBuilder } = require('discord.js');
134
+ - import { SlashCommandBuilder, ContextMenuCommandBuilder } from 'discord.js';
135
+ + const { SlashCommandBuilder, ContextMenuCommandBuilder } = require('reciple');
136
+ + import { SlashCommandBuilder, ContextMenuCommandBuilder } from 'reciple';
137
+ ```
138
+
139
+ You can add your commands in the commands property of your module script.
140
+
141
+ ```js
142
+ export default {
143
+ versions: '^7',
144
+ commands: [
145
+ new SlashCommandBuilder()
146
+ .setName('ping')
147
+ .setDescription('Just a ping command')
148
+ .setExecute(async ({ interaction }) => {
149
+ await interaction.reply('Pong');
150
+ })
151
+ ],
152
+ onStart: async client => {
153
+ return true;
154
+ }
155
+ };
156
+ ```
157
+
158
+ ### Interaction command execute params
159
+
160
+ - [ContextMenuCommandExecuteData](https://reciple.js.org/docs/client/main/typedefs/ContextMenuCommandExecuteData)
161
+ - [SlashCommandExecuteData](https://reciple.js.org/docs/client/main/typedefs/SlashCommandExecuteData)
162
+
163
+ ### Message command execute params
164
+
165
+ - [MessageCommandExecuteData](https://reciple.js.org/docs/client/main/typedefs/MessageCommandExecuteData)
166
+
167
+ ### Handling command execute errors
168
+
169
+ Command halt function can handle command cooldown and errors. Return `true` if the error or cooldown is handled.
170
+
171
+ ```js
172
+ new SlashCommandBuilder()
173
+ .setName('ping')
174
+ .setDescription('Just a ping command')
175
+ .setExecute(async ({ interaction }) => {
176
+ await interaction.reply('Pong');
177
+ })
178
+ .setHalt(async haltData => {
179
+ switch (haltData.reason) {
180
+ case CommandHaltReason.Cooldown:
181
+ await haltData.executeData.interaction.followUp(`You've been cooled-down`);
182
+ return true;
183
+ case CommandHaltReason.Error:
184
+ await haltData.executeData.interaction.followUp('An error occured');
185
+ return true;
186
+ }
187
+
188
+ // The rest is unhandled
189
+ })
190
+ ```
191
+
192
+ ### Using command preconditions
193
+
194
+ Command preconditions are executed after the command is received and before executing the command's execute function.
195
+
196
+ #### Module command preconditions
197
+
198
+ You can define a precondition for all commands of a module.
199
+
200
+ ##### Valid module precondition methods
201
+
202
+ - [Context meny command preconditions](https://reciple.js.org/docs/client/main/typedefs/RecipleModuleScript#contextMenuCommandPrecondition)
203
+ - [Message command preconditions](https://reciple.js.org/docs/client/main/typedefs/RecipleModuleScript#messageCommandPrecondition)
204
+ - [Slash command preconditions](https://reciple.js.org/docs/client/main/typedefs/RecipleModuleScript#slashCommandPrecondition)
205
+
206
+ ```js
207
+ // Example module with slash commands precondition
208
+ export default {
209
+ versions: '^7',
210
+ commands: [
211
+ new SlashCommandBuilder()
212
+ .setName('ping')
213
+ .setDescription('Just a ping command')
214
+ .setExecute(async ({ interaction }) => {
215
+ await interaction.reply('Pong');
216
+ })
217
+ ],
218
+ onStart: async client => true,
219
+
220
+ // creates a slash command precondition
221
+ slashCommandPrecondition: async (({ interaction })) => {
222
+ return !interaction.inCachedGuild() || interaction.guild.ownerId !== interaction.user.id; // Command can only be executed by the guild owner
223
+ }
224
+ };
225
+ ```
226
+
227
+ #### Global command preconditions
228
+
229
+ Global preconditions are added to all commands along with the existing module preconditions.
230
+
231
+ ##### Set & Get global preconditions
232
+ - [CommandManager#setGlobalPrecondition](https://reciple.js.org/docs/client/main/classes/CommandManager#setGlobalPrecondition)
233
+ - [CommandManager#getGlobalPrecondition](https://reciple.js.org/docs/client/main/classes/CommandManager#getGlobalPrecondition)
234
+
235
+ ```js
236
+ // Example module with global slash commands precondition
237
+ export default {
238
+ versions: '^7',
239
+ commands: [
240
+ new SlashCommandBuilder()
241
+ .setName('ping')
242
+ .setDescription('Just a ping command')
243
+ .setExecute(async ({ interaction }) => {
244
+ await interaction.reply('Pong');
245
+ })
246
+ ],
247
+ onStart: async client => true,
248
+ onLoad: async client => {
249
+ client.commands.setGlobalPrecondition(
250
+ CommandType.SlashCommand,
251
+ async ({ interaction }) => {
252
+ return interaction.inCachedGuild(); // All slash commands can only be executed if in cached guild
253
+ }
254
+ );
255
+ }
256
+ };
257
+ ```
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": "7.11.14",
5
+ "version": "7.11.15",
6
6
  "type": "module",
7
7
  "types": "./bin/bin.d.ts",
8
8
  "bin": "./bin/bin.js",
@@ -32,9 +32,9 @@
32
32
  "@types/node": "^20.6.3",
33
33
  "discord.js": "^14.13.0",
34
34
  "nodemon": "^3.0.1",
35
- "reciple": "^7.9.11",
35
+ "reciple": "^7.9.12",
36
36
  "rimraf": "^5.0.1",
37
37
  "typescript": "^5.2.2"
38
38
  },
39
- "gitHead": "44727a379456ebe0ecd124143e2a453caa8e3be3"
39
+ "gitHead": "2057e052bbab4f99ea8ddd4ce78ebdf940ad1509"
40
40
  }
@@ -1,16 +1,16 @@
1
- {
2
- "name": "reciple-app",
3
- "private": true,
4
- "scripts": {
5
- "start": "reciple",
6
- "dev": "nodemon --ext js,mjs,cjs,json,yml,yaml --exec \"reciple\" --signal SIGHUP"
7
- },
8
- "dependencies": {
9
- "discord.js": "DISCORDJS",
10
- "reciple": "RECIPLE"
11
- },
12
- "devDependencies": {
13
- "@types/node": "TYPES_NODE",
14
- "nodemon": "NODEMON"
15
- }
1
+ {
2
+ "name": "reciple-app",
3
+ "private": true,
4
+ "scripts": {
5
+ "start": "reciple",
6
+ "dev": "nodemon --ext js,mjs,cjs,json,yml,yaml --exec \"reciple\" --signal SIGHUP"
7
+ },
8
+ "dependencies": {
9
+ "discord.js": "DISCORDJS",
10
+ "reciple": "RECIPLE"
11
+ },
12
+ "devDependencies": {
13
+ "@types/node": "TYPES_NODE",
14
+ "nodemon": "NODEMON"
15
+ }
16
16
  }
@@ -1,17 +1,17 @@
1
- {
2
- "name": "reciple-app",
3
- "private": true,
4
- "type": "module",
5
- "scripts": {
6
- "start": "reciple",
7
- "dev": "nodemon --ext js,mjs,cjs,json,yml,yaml --exec \"reciple\" --signal SIGHUP"
8
- },
9
- "dependencies": {
10
- "discord.js": "DISCORDJS",
11
- "reciple": "RECIPLE"
12
- },
13
- "devDependencies": {
14
- "@types/node": "TYPES_NODE",
15
- "nodemon": "NODEMON"
16
- }
1
+ {
2
+ "name": "reciple-app",
3
+ "private": true,
4
+ "type": "module",
5
+ "scripts": {
6
+ "start": "reciple",
7
+ "dev": "nodemon --ext js,mjs,cjs,json,yml,yaml --exec \"reciple\" --signal SIGHUP"
8
+ },
9
+ "dependencies": {
10
+ "discord.js": "DISCORDJS",
11
+ "reciple": "RECIPLE"
12
+ },
13
+ "devDependencies": {
14
+ "@types/node": "TYPES_NODE",
15
+ "nodemon": "NODEMON"
16
+ }
17
17
  }