create-reciple 9.7.1 → 9.9.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 +44 -44
- package/package.json +9 -9
- package/templates/javascript/modules/commands/PingCommand.js +68 -68
- package/templates/javascript/modules/events/WelcomeEvent.js +54 -54
- package/templates/javascript/modules/halts/CommandErrorHalt.js +59 -59
- package/templates/javascript/modules/preconditions/ExamplePrecondition.js +27 -27
- package/templates/javascript/nodemon.json +15 -15
- package/templates/javascript/package.json +17 -17
- package/templates/typescript/nodemon.json +16 -16
- package/templates/typescript/package.json +21 -21
- package/templates/typescript/src/halts/CommandErrorHalt.ts +44 -44
- package/templates/typescript/src/preconditions/ExamplePrecondition.ts +18 -18
package/README.md
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
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/create-reciple">
|
|
11
|
-
<img src="https://img.shields.io/npm/v/create-reciple?label=npm">
|
|
12
|
-
</a>
|
|
13
|
-
<a href="https://github.com/thenorthsolution/Reciple/tree/main/packages/create-reciple">
|
|
14
|
-
<img src="https://img.shields.io/npm/dt/create-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
|
-
## About
|
|
30
|
-
|
|
31
|
-
`create-reciple` is a tool used to easily create Reciple projects.
|
|
32
|
-
|
|
33
|
-
## Installation
|
|
34
|
-
|
|
35
|
-
```bash
|
|
36
|
-
npm create reciple@latest
|
|
37
|
-
yarn create reciple@latest
|
|
38
|
-
pnpm create reciple@latest
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
## Templates
|
|
42
|
-
- Javascript (ES Modules)
|
|
43
|
-
- Typescript (ES Modules)
|
|
44
|
-
|
|
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/create-reciple">
|
|
11
|
+
<img src="https://img.shields.io/npm/v/create-reciple?label=npm">
|
|
12
|
+
</a>
|
|
13
|
+
<a href="https://github.com/thenorthsolution/Reciple/tree/main/packages/create-reciple">
|
|
14
|
+
<img src="https://img.shields.io/npm/dt/create-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
|
+
## About
|
|
30
|
+
|
|
31
|
+
`create-reciple` is a tool used to easily create Reciple projects.
|
|
32
|
+
|
|
33
|
+
## Installation
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
npm create reciple@latest
|
|
37
|
+
yarn create reciple@latest
|
|
38
|
+
pnpm create reciple@latest
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Templates
|
|
42
|
+
- Javascript (ES Modules)
|
|
43
|
+
- Typescript (ES Modules)
|
|
44
|
+
|
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": "9.
|
|
5
|
+
"version": "9.9.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
8
8
|
"module": "./dist/index.js",
|
|
@@ -37,23 +37,23 @@
|
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@clack/prompts": "^0.7.0",
|
|
40
|
-
"@reciple/core": "^9.
|
|
41
|
-
"@reciple/decorators": "^9.
|
|
42
|
-
"@reciple/utils": "^9.
|
|
40
|
+
"@reciple/core": "^9.7.0",
|
|
41
|
+
"@reciple/decorators": "^9.3.0",
|
|
42
|
+
"@reciple/utils": "^9.5.0",
|
|
43
43
|
"commander": "^12.1.0",
|
|
44
44
|
"compressing": "^1.10.1",
|
|
45
45
|
"detect-indent": "^7.0.1",
|
|
46
|
-
"discord.js": "^14.
|
|
46
|
+
"discord.js": "^14.16.1",
|
|
47
47
|
"fallout-utility": "^2.9.1",
|
|
48
|
-
"ora": "^8.0
|
|
48
|
+
"ora": "^8.1.0",
|
|
49
49
|
"package-json": "^10.0.1",
|
|
50
|
-
"reciple": "^9.
|
|
50
|
+
"reciple": "^9.7.0"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@types/node": "^22.
|
|
53
|
+
"@types/node": "^22.5.2",
|
|
54
54
|
"nodemon": "^3.1.4",
|
|
55
55
|
"rimraf": "^6.0.1",
|
|
56
56
|
"typescript": "^5.5.4"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "90fe23b2c0b87d78e94ef1fd745e46299917da73"
|
|
59
59
|
}
|
|
@@ -1,68 +1,68 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
import { CommandType, ContextMenuCommandBuilder, MessageCommandBuilder, SlashCommandBuilder } from "reciple";
|
|
3
|
-
|
|
4
|
-
export class PingCommand {
|
|
5
|
-
/**
|
|
6
|
-
* The module commands.
|
|
7
|
-
* @typedef {import("reciple").AnyCommandResolvable[]}
|
|
8
|
-
*/
|
|
9
|
-
commands = [
|
|
10
|
-
new SlashCommandBuilder()
|
|
11
|
-
.setName('ping')
|
|
12
|
-
.setDescription('Replies with pong!')
|
|
13
|
-
.setExecute(data => this.handleCommandExecute(data)),
|
|
14
|
-
|
|
15
|
-
new ContextMenuCommandBuilder()
|
|
16
|
-
.setName('ping')
|
|
17
|
-
.setType('Message')
|
|
18
|
-
.setExecute(data => this.handleCommandExecute(data)),
|
|
19
|
-
|
|
20
|
-
new MessageCommandBuilder()
|
|
21
|
-
.setName('ping')
|
|
22
|
-
.setDescription('Replies with pong!')
|
|
23
|
-
.setExecute(data => this.handleCommandExecute(data))
|
|
24
|
-
];
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Executed when module is started (Bot is not logged in).
|
|
28
|
-
*
|
|
29
|
-
* @return {Promise<boolean>}
|
|
30
|
-
*/
|
|
31
|
-
async onStart() {
|
|
32
|
-
return true;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Executes when the module is loaded (Bot is logged in).
|
|
37
|
-
*
|
|
38
|
-
* @return {Promise<void>}
|
|
39
|
-
*/
|
|
40
|
-
async onLoad() {}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Executes when the module is unloaded (Bot is pre log out).
|
|
44
|
-
*
|
|
45
|
-
* @return {Promise<void>}
|
|
46
|
-
*/
|
|
47
|
-
async onUnload() {}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Called by the command builder when a command is executed.
|
|
51
|
-
*
|
|
52
|
-
* @param {import("reciple").AnyCommandExecuteData} data
|
|
53
|
-
* @returns {Promise<void>}
|
|
54
|
-
*/
|
|
55
|
-
async handleCommandExecute(data) {
|
|
56
|
-
switch (data.type) {
|
|
57
|
-
case CommandType.ContextMenuCommand:
|
|
58
|
-
case CommandType.SlashCommand:
|
|
59
|
-
await data.interaction.reply('Pong!');
|
|
60
|
-
return;
|
|
61
|
-
case CommandType.MessageCommand:
|
|
62
|
-
await data.message.reply('Pong!');
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export default new PingCommand();
|
|
1
|
+
// @ts-check
|
|
2
|
+
import { CommandType, ContextMenuCommandBuilder, MessageCommandBuilder, SlashCommandBuilder } from "reciple";
|
|
3
|
+
|
|
4
|
+
export class PingCommand {
|
|
5
|
+
/**
|
|
6
|
+
* The module commands.
|
|
7
|
+
* @typedef {import("reciple").AnyCommandResolvable[]}
|
|
8
|
+
*/
|
|
9
|
+
commands = [
|
|
10
|
+
new SlashCommandBuilder()
|
|
11
|
+
.setName('ping')
|
|
12
|
+
.setDescription('Replies with pong!')
|
|
13
|
+
.setExecute(data => this.handleCommandExecute(data)),
|
|
14
|
+
|
|
15
|
+
new ContextMenuCommandBuilder()
|
|
16
|
+
.setName('ping')
|
|
17
|
+
.setType('Message')
|
|
18
|
+
.setExecute(data => this.handleCommandExecute(data)),
|
|
19
|
+
|
|
20
|
+
new MessageCommandBuilder()
|
|
21
|
+
.setName('ping')
|
|
22
|
+
.setDescription('Replies with pong!')
|
|
23
|
+
.setExecute(data => this.handleCommandExecute(data))
|
|
24
|
+
];
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Executed when module is started (Bot is not logged in).
|
|
28
|
+
*
|
|
29
|
+
* @return {Promise<boolean>}
|
|
30
|
+
*/
|
|
31
|
+
async onStart() {
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Executes when the module is loaded (Bot is logged in).
|
|
37
|
+
*
|
|
38
|
+
* @return {Promise<void>}
|
|
39
|
+
*/
|
|
40
|
+
async onLoad() {}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Executes when the module is unloaded (Bot is pre log out).
|
|
44
|
+
*
|
|
45
|
+
* @return {Promise<void>}
|
|
46
|
+
*/
|
|
47
|
+
async onUnload() {}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Called by the command builder when a command is executed.
|
|
51
|
+
*
|
|
52
|
+
* @param {import("reciple").AnyCommandExecuteData} data
|
|
53
|
+
* @returns {Promise<void>}
|
|
54
|
+
*/
|
|
55
|
+
async handleCommandExecute(data) {
|
|
56
|
+
switch (data.type) {
|
|
57
|
+
case CommandType.ContextMenuCommand:
|
|
58
|
+
case CommandType.SlashCommand:
|
|
59
|
+
await data.interaction.reply('Pong!');
|
|
60
|
+
return;
|
|
61
|
+
case CommandType.MessageCommand:
|
|
62
|
+
await data.message.reply('Pong!');
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export default new PingCommand();
|
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
|
|
3
|
-
import { GuildMember } from "discord.js";
|
|
4
|
-
|
|
5
|
-
export class WelcomeEvent {
|
|
6
|
-
constructor() {
|
|
7
|
-
// Make sure `handleWelcomeEvent` is bound to `this`
|
|
8
|
-
this.handleWelcomeEvent = this.handleWelcomeEvent.bind(this);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Executed when module is started (Bot is not logged in).
|
|
13
|
-
*
|
|
14
|
-
* @return {Promise<boolean>}
|
|
15
|
-
*/
|
|
16
|
-
async onStart() {
|
|
17
|
-
return true;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Executes when the module is loaded (Bot is logged in).
|
|
22
|
-
*
|
|
23
|
-
* @param {import("reciple").RecipleModuleLoadData} param0
|
|
24
|
-
* @return {Promise<void>}
|
|
25
|
-
*/
|
|
26
|
-
async onLoad({ client }) {
|
|
27
|
-
// Add the listener to the client
|
|
28
|
-
client.on('guildMemberAdd', this.handleWelcomeEvent);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Executes when the module is unloaded (Bot is pre log out).
|
|
33
|
-
*
|
|
34
|
-
* @param {import("reciple").RecipleModuleUnloadData} param0
|
|
35
|
-
* @return {Promise<void>}
|
|
36
|
-
*/
|
|
37
|
-
async onUnload({ client }) {
|
|
38
|
-
// Properly remove the listener from the client
|
|
39
|
-
client.removeListener('guildMemberAdd', this.handleWelcomeEvent);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Called when a user joins the server.
|
|
44
|
-
*
|
|
45
|
-
* @param {GuildMember} member
|
|
46
|
-
* @return {Promise<void>}
|
|
47
|
-
*/
|
|
48
|
-
async handleWelcomeEvent(member) {
|
|
49
|
-
await member.send(`Welcome to **${member.guild.name}** server!`)
|
|
50
|
-
.catch(() => null);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export default new WelcomeEvent();
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
3
|
+
import { GuildMember } from "discord.js";
|
|
4
|
+
|
|
5
|
+
export class WelcomeEvent {
|
|
6
|
+
constructor() {
|
|
7
|
+
// Make sure `handleWelcomeEvent` is bound to `this`
|
|
8
|
+
this.handleWelcomeEvent = this.handleWelcomeEvent.bind(this);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Executed when module is started (Bot is not logged in).
|
|
13
|
+
*
|
|
14
|
+
* @return {Promise<boolean>}
|
|
15
|
+
*/
|
|
16
|
+
async onStart() {
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Executes when the module is loaded (Bot is logged in).
|
|
22
|
+
*
|
|
23
|
+
* @param {import("reciple").RecipleModuleLoadData} param0
|
|
24
|
+
* @return {Promise<void>}
|
|
25
|
+
*/
|
|
26
|
+
async onLoad({ client }) {
|
|
27
|
+
// Add the listener to the client
|
|
28
|
+
client.on('guildMemberAdd', this.handleWelcomeEvent);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Executes when the module is unloaded (Bot is pre log out).
|
|
33
|
+
*
|
|
34
|
+
* @param {import("reciple").RecipleModuleUnloadData} param0
|
|
35
|
+
* @return {Promise<void>}
|
|
36
|
+
*/
|
|
37
|
+
async onUnload({ client }) {
|
|
38
|
+
// Properly remove the listener from the client
|
|
39
|
+
client.removeListener('guildMemberAdd', this.handleWelcomeEvent);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Called when a user joins the server.
|
|
44
|
+
*
|
|
45
|
+
* @param {GuildMember} member
|
|
46
|
+
* @return {Promise<void>}
|
|
47
|
+
*/
|
|
48
|
+
async handleWelcomeEvent(member) {
|
|
49
|
+
await member.send(`Welcome to **${member.guild.name}** server!`)
|
|
50
|
+
.catch(() => null);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export default new WelcomeEvent();
|
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
|
|
3
|
-
import { CommandHaltReason, CommandType } from 'reciple';
|
|
4
|
-
|
|
5
|
-
export class CommandErrorHalt {
|
|
6
|
-
id = 'my.reciple.js.commanderrorhalt';
|
|
7
|
-
disabled = false;
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* @param {import('reciple').ContextMenuCommandHaltTriggerData} data
|
|
11
|
-
*/
|
|
12
|
-
contextMenuCommandHalt(data) {
|
|
13
|
-
return this.halt(data);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* @param {import('reciple').MessageCommandHaltTriggerData} data
|
|
18
|
-
*/
|
|
19
|
-
messageCommandHalt(data) {
|
|
20
|
-
return this.halt(data);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* @param {import('reciple').SlashCommandHaltTriggerData} data
|
|
25
|
-
*/
|
|
26
|
-
slashCommandHalt(data) {
|
|
27
|
-
return this.halt(data);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* @param {import('reciple').AnyCommandHaltTriggerData} data
|
|
32
|
-
* @returns
|
|
33
|
-
*/
|
|
34
|
-
async halt(data) {
|
|
35
|
-
if (data.reason !== CommandHaltReason.Error) return;
|
|
36
|
-
|
|
37
|
-
const content = `An error occured while executing this command`;
|
|
38
|
-
|
|
39
|
-
switch (data.commandType) {
|
|
40
|
-
case CommandType.ContextMenuCommand:
|
|
41
|
-
case CommandType.SlashCommand:
|
|
42
|
-
const interaction = data.executeData.interaction;
|
|
43
|
-
|
|
44
|
-
if (interaction.replied || interaction.deferred) {
|
|
45
|
-
await interaction.editReply(content);
|
|
46
|
-
} else {
|
|
47
|
-
await interaction.reply(content);
|
|
48
|
-
}
|
|
49
|
-
break;
|
|
50
|
-
case CommandType.MessageCommand:
|
|
51
|
-
await data.executeData.message.reply(content);
|
|
52
|
-
break;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
reciple.logger?.error(data.error);
|
|
56
|
-
|
|
57
|
-
return true;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
3
|
+
import { CommandHaltReason, CommandType } from 'reciple';
|
|
4
|
+
|
|
5
|
+
export class CommandErrorHalt {
|
|
6
|
+
id = 'my.reciple.js.commanderrorhalt';
|
|
7
|
+
disabled = false;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @param {import('reciple').ContextMenuCommandHaltTriggerData} data
|
|
11
|
+
*/
|
|
12
|
+
contextMenuCommandHalt(data) {
|
|
13
|
+
return this.halt(data);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @param {import('reciple').MessageCommandHaltTriggerData} data
|
|
18
|
+
*/
|
|
19
|
+
messageCommandHalt(data) {
|
|
20
|
+
return this.halt(data);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @param {import('reciple').SlashCommandHaltTriggerData} data
|
|
25
|
+
*/
|
|
26
|
+
slashCommandHalt(data) {
|
|
27
|
+
return this.halt(data);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* @param {import('reciple').AnyCommandHaltTriggerData} data
|
|
32
|
+
* @returns
|
|
33
|
+
*/
|
|
34
|
+
async halt(data) {
|
|
35
|
+
if (data.reason !== CommandHaltReason.Error) return;
|
|
36
|
+
|
|
37
|
+
const content = `An error occured while executing this command`;
|
|
38
|
+
|
|
39
|
+
switch (data.commandType) {
|
|
40
|
+
case CommandType.ContextMenuCommand:
|
|
41
|
+
case CommandType.SlashCommand:
|
|
42
|
+
const interaction = data.executeData.interaction;
|
|
43
|
+
|
|
44
|
+
if (interaction.replied || interaction.deferred) {
|
|
45
|
+
await interaction.editReply(content);
|
|
46
|
+
} else {
|
|
47
|
+
await interaction.reply(content);
|
|
48
|
+
}
|
|
49
|
+
break;
|
|
50
|
+
case CommandType.MessageCommand:
|
|
51
|
+
await data.executeData.message.reply(content);
|
|
52
|
+
break;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
reciple.logger?.error(data.error);
|
|
56
|
+
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
|
|
3
|
-
export class ExamplePrecondition {
|
|
4
|
-
id = 'my.reciple.js.exampleprecondition';
|
|
5
|
-
disabled = false;
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* @param {import("reciple").ContextMenuCommandExecuteData} execute
|
|
9
|
-
*/
|
|
10
|
-
contextMenuCommandExecute(execute) {
|
|
11
|
-
return true;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* @param {import("reciple").MessageCommandExecuteData} excute
|
|
16
|
-
*/
|
|
17
|
-
messageCommandExecute(excute) {
|
|
18
|
-
return true;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* @param {import("reciple").SlashCommandExecuteData} execute
|
|
23
|
-
*/
|
|
24
|
-
slashCommandExecute(execute) {
|
|
25
|
-
return true;
|
|
26
|
-
}
|
|
27
|
-
};
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
3
|
+
export class ExamplePrecondition {
|
|
4
|
+
id = 'my.reciple.js.exampleprecondition';
|
|
5
|
+
disabled = false;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @param {import("reciple").ContextMenuCommandExecuteData} execute
|
|
9
|
+
*/
|
|
10
|
+
contextMenuCommandExecute(execute) {
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @param {import("reciple").MessageCommandExecuteData} excute
|
|
16
|
+
*/
|
|
17
|
+
messageCommandExecute(excute) {
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @param {import("reciple").SlashCommandExecuteData} execute
|
|
23
|
+
*/
|
|
24
|
+
slashCommandExecute(execute) {
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://raw.githubusercontent.com/SchemaStore/schemastore/master/src/schemas/json/nodemon.json",
|
|
3
|
-
"restartable": "r",
|
|
4
|
-
"ext": "js,mjs,json",
|
|
5
|
-
"signal": "SIGHUP",
|
|
6
|
-
"ignore": [
|
|
7
|
-
".git",
|
|
8
|
-
"node_modules/**"
|
|
9
|
-
],
|
|
10
|
-
"watch": [
|
|
11
|
-
"src",
|
|
12
|
-
"reciple.mjs",
|
|
13
|
-
".env"
|
|
14
|
-
],
|
|
15
|
-
"exec": "reciple start"
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://raw.githubusercontent.com/SchemaStore/schemastore/master/src/schemas/json/nodemon.json",
|
|
3
|
+
"restartable": "r",
|
|
4
|
+
"ext": "js,mjs,json",
|
|
5
|
+
"signal": "SIGHUP",
|
|
6
|
+
"ignore": [
|
|
7
|
+
".git",
|
|
8
|
+
"node_modules/**"
|
|
9
|
+
],
|
|
10
|
+
"watch": [
|
|
11
|
+
"src",
|
|
12
|
+
"reciple.mjs",
|
|
13
|
+
".env"
|
|
14
|
+
],
|
|
15
|
+
"exec": "reciple start"
|
|
16
16
|
}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "reciple-app",
|
|
3
|
-
"type": "module",
|
|
4
|
-
"private": true,
|
|
5
|
-
"scripts": {
|
|
6
|
-
"start": "reciple start -c reciple.mjs",
|
|
7
|
-
"dev": "nodemon --config nodemon.json"
|
|
8
|
-
},
|
|
9
|
-
"dependencies": {
|
|
10
|
-
"@reciple/core": "RECIPLE_CORE",
|
|
11
|
-
"discord.js": "DISCORDJS",
|
|
12
|
-
"reciple": "RECIPLE"
|
|
13
|
-
},
|
|
14
|
-
"devDependencies": {
|
|
15
|
-
"@types/node": "TYPES_NODE",
|
|
16
|
-
"nodemon": "NODEMON"
|
|
17
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "reciple-app",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"private": true,
|
|
5
|
+
"scripts": {
|
|
6
|
+
"start": "reciple start -c reciple.mjs",
|
|
7
|
+
"dev": "nodemon --config nodemon.json"
|
|
8
|
+
},
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"@reciple/core": "RECIPLE_CORE",
|
|
11
|
+
"discord.js": "DISCORDJS",
|
|
12
|
+
"reciple": "RECIPLE"
|
|
13
|
+
},
|
|
14
|
+
"devDependencies": {
|
|
15
|
+
"@types/node": "TYPES_NODE",
|
|
16
|
+
"nodemon": "NODEMON"
|
|
17
|
+
}
|
|
18
18
|
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://raw.githubusercontent.com/SchemaStore/schemastore/master/src/schemas/json/nodemon.json",
|
|
3
|
-
"restartable": "r",
|
|
4
|
-
"ext": "ts,mts,mjs,json",
|
|
5
|
-
"signal": "SIGHUP",
|
|
6
|
-
"ignore": [
|
|
7
|
-
".git",
|
|
8
|
-
"node_modules/**",
|
|
9
|
-
"modules"
|
|
10
|
-
],
|
|
11
|
-
"watch": [
|
|
12
|
-
"src",
|
|
13
|
-
"reciple.mjs",
|
|
14
|
-
".env"
|
|
15
|
-
],
|
|
16
|
-
"exec": "rimraf ./modules && tsc && reciple start"
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://raw.githubusercontent.com/SchemaStore/schemastore/master/src/schemas/json/nodemon.json",
|
|
3
|
+
"restartable": "r",
|
|
4
|
+
"ext": "ts,mts,mjs,json",
|
|
5
|
+
"signal": "SIGHUP",
|
|
6
|
+
"ignore": [
|
|
7
|
+
".git",
|
|
8
|
+
"node_modules/**",
|
|
9
|
+
"modules"
|
|
10
|
+
],
|
|
11
|
+
"watch": [
|
|
12
|
+
"src",
|
|
13
|
+
"reciple.mjs",
|
|
14
|
+
".env"
|
|
15
|
+
],
|
|
16
|
+
"exec": "rimraf ./modules && tsc && reciple start"
|
|
17
17
|
}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "reciple-app",
|
|
3
|
-
"type": "module",
|
|
4
|
-
"private": true,
|
|
5
|
-
"scripts": {
|
|
6
|
-
"build": "rimraf ./modules && tsc",
|
|
7
|
-
"start": "reciple start -c reciple.mjs",
|
|
8
|
-
"build:start": "SCRIPT_RUN build && reciple start -c reciple.mjs",
|
|
9
|
-
"dev": "
|
|
10
|
-
},
|
|
11
|
-
"dependencies": {
|
|
12
|
-
"@reciple/core": "RECIPLE_CORE",
|
|
13
|
-
"@reciple/decorators": "RECIPLE_DECORATORS",
|
|
14
|
-
"discord.js": "DISCORDJS",
|
|
15
|
-
"reciple": "RECIPLE"
|
|
16
|
-
},
|
|
17
|
-
"devDependencies": {
|
|
18
|
-
"@types/node": "TYPES_NODE",
|
|
19
|
-
"typescript": "TYPESCRIPT",
|
|
20
|
-
"rimraf": "RIMRAF"
|
|
21
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "reciple-app",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"private": true,
|
|
5
|
+
"scripts": {
|
|
6
|
+
"build": "rimraf ./modules && tsc",
|
|
7
|
+
"start": "reciple start -c reciple.mjs",
|
|
8
|
+
"build:start": "SCRIPT_RUN build && reciple start -c reciple.mjs",
|
|
9
|
+
"dev": "nodemon --config nodemon.json"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@reciple/core": "RECIPLE_CORE",
|
|
13
|
+
"@reciple/decorators": "RECIPLE_DECORATORS",
|
|
14
|
+
"discord.js": "DISCORDJS",
|
|
15
|
+
"reciple": "RECIPLE"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"@types/node": "TYPES_NODE",
|
|
19
|
+
"typescript": "TYPESCRIPT",
|
|
20
|
+
"rimraf": "RIMRAF"
|
|
21
|
+
}
|
|
22
22
|
}
|
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
import { AnyCommandHaltTriggerData, CommandHaltData, CommandHaltReason, CommandType, ContextMenuCommandHaltTriggerData, MessageCommandHaltTriggerData, SlashCommandHaltTriggerData } from 'reciple';
|
|
2
|
-
|
|
3
|
-
export class CommandErrorHalt implements CommandHaltData {
|
|
4
|
-
id = 'my.reciple.js.commanderrorhalt';
|
|
5
|
-
disabled = false;
|
|
6
|
-
|
|
7
|
-
contextMenuCommandHalt(data: ContextMenuCommandHaltTriggerData) {
|
|
8
|
-
return this.halt(data);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
messageCommandHalt(data: MessageCommandHaltTriggerData) {
|
|
12
|
-
return this.halt(data);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
slashCommandHalt(data: SlashCommandHaltTriggerData) {
|
|
16
|
-
return this.halt(data);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
async halt(data: AnyCommandHaltTriggerData) {
|
|
20
|
-
if (data.reason !== CommandHaltReason.Error) return;
|
|
21
|
-
|
|
22
|
-
const content = `An error occured while executing this command`;
|
|
23
|
-
|
|
24
|
-
switch (data.commandType) {
|
|
25
|
-
case CommandType.ContextMenuCommand:
|
|
26
|
-
case CommandType.SlashCommand:
|
|
27
|
-
const interaction = data.executeData.interaction;
|
|
28
|
-
|
|
29
|
-
if (interaction.replied || interaction.deferred) {
|
|
30
|
-
await interaction.editReply(content);
|
|
31
|
-
} else {
|
|
32
|
-
await interaction.reply(content);
|
|
33
|
-
}
|
|
34
|
-
break;
|
|
35
|
-
case CommandType.MessageCommand:
|
|
36
|
-
await data.executeData.message.reply(content);
|
|
37
|
-
break;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
reciple.logger?.error(data.error);
|
|
41
|
-
|
|
42
|
-
return true;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
1
|
+
import { AnyCommandHaltTriggerData, CommandHaltData, CommandHaltReason, CommandType, ContextMenuCommandHaltTriggerData, MessageCommandHaltTriggerData, SlashCommandHaltTriggerData } from 'reciple';
|
|
2
|
+
|
|
3
|
+
export class CommandErrorHalt implements CommandHaltData {
|
|
4
|
+
id = 'my.reciple.js.commanderrorhalt';
|
|
5
|
+
disabled = false;
|
|
6
|
+
|
|
7
|
+
contextMenuCommandHalt(data: ContextMenuCommandHaltTriggerData) {
|
|
8
|
+
return this.halt(data);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
messageCommandHalt(data: MessageCommandHaltTriggerData) {
|
|
12
|
+
return this.halt(data);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
slashCommandHalt(data: SlashCommandHaltTriggerData) {
|
|
16
|
+
return this.halt(data);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
async halt(data: AnyCommandHaltTriggerData) {
|
|
20
|
+
if (data.reason !== CommandHaltReason.Error) return;
|
|
21
|
+
|
|
22
|
+
const content = `An error occured while executing this command`;
|
|
23
|
+
|
|
24
|
+
switch (data.commandType) {
|
|
25
|
+
case CommandType.ContextMenuCommand:
|
|
26
|
+
case CommandType.SlashCommand:
|
|
27
|
+
const interaction = data.executeData.interaction;
|
|
28
|
+
|
|
29
|
+
if (interaction.replied || interaction.deferred) {
|
|
30
|
+
await interaction.editReply(content);
|
|
31
|
+
} else {
|
|
32
|
+
await interaction.reply(content);
|
|
33
|
+
}
|
|
34
|
+
break;
|
|
35
|
+
case CommandType.MessageCommand:
|
|
36
|
+
await data.executeData.message.reply(content);
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
reciple.logger?.error(data.error);
|
|
41
|
+
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { CommandPreconditionData, ContextMenuCommandExecuteData, MessageCommandExecuteData, SlashCommandExecuteData } from 'reciple';
|
|
2
|
-
|
|
3
|
-
export class ExamplePrecondition implements CommandPreconditionData {
|
|
4
|
-
id = 'my.reciple.js.exampleprecondition';
|
|
5
|
-
disabled = false;
|
|
6
|
-
|
|
7
|
-
contextMenuCommandExecute(execute: ContextMenuCommandExecuteData) {
|
|
8
|
-
return true;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
messageCommandExecute(excute: MessageCommandExecuteData) {
|
|
12
|
-
return true;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
slashCommandExecute(execute: SlashCommandExecuteData) {
|
|
16
|
-
return true;
|
|
17
|
-
}
|
|
18
|
-
};
|
|
1
|
+
import { CommandPreconditionData, ContextMenuCommandExecuteData, MessageCommandExecuteData, SlashCommandExecuteData } from 'reciple';
|
|
2
|
+
|
|
3
|
+
export class ExamplePrecondition implements CommandPreconditionData {
|
|
4
|
+
id = 'my.reciple.js.exampleprecondition';
|
|
5
|
+
disabled = false;
|
|
6
|
+
|
|
7
|
+
contextMenuCommandExecute(execute: ContextMenuCommandExecuteData) {
|
|
8
|
+
return true;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
messageCommandExecute(excute: MessageCommandExecuteData) {
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
slashCommandExecute(execute: SlashCommandExecuteData) {
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
};
|