reciple 7.0.0-dev.11 → 7.0.0-dev.13
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 +45 -37
- package/bin/classes/Config.js +1 -1
- package/bin/classes/Config.js.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -13,20 +13,20 @@
|
|
|
13
13
|
<a href="https://www.codefactor.io/repository/github/falloutstudios/reciple/overview/main">
|
|
14
14
|
<img src="https://www.codefactor.io/repository/github/falloutstudios/reciple/badge/main">
|
|
15
15
|
</a>
|
|
16
|
-
|
|
17
|
-
A simple Dicord.js handler that just works.
|
|
16
|
+
<br>
|
|
17
|
+
A simple Dicord.js handler that just works.
|
|
18
18
|
</h3>
|
|
19
19
|
|
|
20
20
|
# Features
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
22
|
+
- [CLI based handler](#cli-usage)
|
|
23
|
+
- [Supports Context Menus](#context-menus)
|
|
24
|
+
- [Supports Prefix/Message commands](#message-commands)
|
|
25
|
+
- [Validate messsage command options](#validate-message-command-options)
|
|
26
|
+
- [Supports Slash Commands](#slash-commands)
|
|
27
|
+
- [Built-in command cooldowns](#command-cooldowns)
|
|
28
|
+
- Automatically register application commands
|
|
29
|
+
- [Highly configurable](#config)
|
|
30
30
|
|
|
31
31
|
## Installation
|
|
32
32
|
|
|
@@ -47,6 +47,7 @@ It will ask you to continue if the directory is not empty. Type `y` to continue.
|
|
|
47
47
|
> You can change the token anytime you want
|
|
48
48
|
|
|
49
49
|
## CLI usage
|
|
50
|
+
|
|
50
51
|
```yml
|
|
51
52
|
Usage: reciple [options] [cwd]
|
|
52
53
|
|
|
@@ -70,36 +71,38 @@ Options:
|
|
|
70
71
|
Reciple provides built-in `MessageCommandBuilder` class that can be used for message command handler.
|
|
71
72
|
|
|
72
73
|
```js
|
|
73
|
-
const { MessageCommandBuilder } = require(
|
|
74
|
+
const { MessageCommandBuilder } = require("reciple");
|
|
74
75
|
|
|
75
76
|
new MessageCommandBuilder()
|
|
76
77
|
.setName("command")
|
|
77
78
|
.setDescription("Your lil tiny description")
|
|
78
|
-
.addAliases(
|
|
79
|
-
.setExecute(command => command.message.reply("Hello!"))
|
|
79
|
+
.addAliases("cmd", "cmd1")
|
|
80
|
+
.setExecute((command) => command.message.reply("Hello!"));
|
|
80
81
|
```
|
|
81
82
|
|
|
82
83
|
### Validate Message Command Options
|
|
83
84
|
|
|
84
85
|
```js
|
|
85
|
-
const { MessageCommandBuilder } = require(
|
|
86
|
+
const { MessageCommandBuilder } = require("reciple");
|
|
86
87
|
|
|
87
88
|
new MessageCommandBuilder()
|
|
88
89
|
.setName("command")
|
|
89
90
|
.setDescription("Your lil tiny description")
|
|
90
|
-
.addAliases(
|
|
91
|
+
.addAliases("cmd", "cmd1")
|
|
91
92
|
.setValidateOptions(true) // Validate options
|
|
92
|
-
.addOption(
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
93
|
+
.addOption(
|
|
94
|
+
(option) =>
|
|
95
|
+
option
|
|
96
|
+
.setName("quantity")
|
|
97
|
+
.setDescription("Must be a number")
|
|
98
|
+
.setRequired(true) // A required option
|
|
99
|
+
.setValidator((val) => !isNaN(Number(val))) // Validate value
|
|
97
100
|
)
|
|
98
|
-
.setExecute(async command => {
|
|
99
|
-
const quantity = Number(command.options.getValue(
|
|
101
|
+
.setExecute(async (command) => {
|
|
102
|
+
const quantity = Number(command.options.getValue("quantity", true));
|
|
100
103
|
|
|
101
104
|
await command.message.reply("Quantity: " + quantity);
|
|
102
|
-
})
|
|
105
|
+
});
|
|
103
106
|
```
|
|
104
107
|
|
|
105
108
|
## Context Menus
|
|
@@ -107,16 +110,16 @@ new MessageCommandBuilder()
|
|
|
107
110
|
Reciple provides custom `ContextMenuBuilder` class that can be used for context menu command handler.
|
|
108
111
|
|
|
109
112
|
```js
|
|
110
|
-
const { ContextMenuBuilder } = require(
|
|
111
|
-
const { ApplicationCommandType } = require(
|
|
113
|
+
const { ContextMenuBuilder } = require("reciple");
|
|
114
|
+
const { ApplicationCommandType } = require("discord.js");
|
|
112
115
|
|
|
113
116
|
new ContextMenuBuilder()
|
|
114
|
-
.setName(
|
|
117
|
+
.setName("Ban")
|
|
115
118
|
.setType(ApplicationCommandType.User)
|
|
116
119
|
.setExecute(async ({ interaction }) => {
|
|
117
120
|
if (!interaction.inCachedGuild()) return;
|
|
118
121
|
await interaction.member.ban();
|
|
119
|
-
})
|
|
122
|
+
});
|
|
120
123
|
```
|
|
121
124
|
|
|
122
125
|
## Slash Commands
|
|
@@ -124,34 +127,38 @@ new ContextMenuBuilder()
|
|
|
124
127
|
Reciple provides custom `SlashCommandBuilder` class that can be used for slash command handler.
|
|
125
128
|
|
|
126
129
|
```js
|
|
127
|
-
const { SlashCommandBuilder } = require(
|
|
130
|
+
const { SlashCommandBuilder } = require("reciple");
|
|
128
131
|
|
|
129
132
|
new SlashCommandBuilder()
|
|
130
|
-
.setName(
|
|
131
|
-
.setDescription(
|
|
132
|
-
.setExecute(async ({ interaction }) => interaction.reply(`Pong!`))
|
|
133
|
+
.setName("ping")
|
|
134
|
+
.setDescription("Pong")
|
|
135
|
+
.setExecute(async ({ interaction }) => interaction.reply(`Pong!`));
|
|
133
136
|
```
|
|
134
137
|
|
|
135
138
|
## Command Cooldowns
|
|
136
139
|
|
|
137
140
|
```js
|
|
138
|
-
const {
|
|
139
|
-
|
|
141
|
+
const {
|
|
142
|
+
MessageCommandBuilder,
|
|
143
|
+
MessageCommandBuilder,
|
|
144
|
+
SlashCommandBuilder,
|
|
145
|
+
} = require("reciple");
|
|
146
|
+
const { ApplicationCommandType } = require("discord.js");
|
|
140
147
|
|
|
141
148
|
new ContextMenuCommandBuilder()
|
|
142
|
-
.setName(
|
|
149
|
+
.setName("Context Menu")
|
|
143
150
|
.setType(ApplicationCommandType.Message)
|
|
144
151
|
.setCooldown(1000 * 5) // 5 seconds cooldown
|
|
145
152
|
.setExecute(async ({ interaction }) => interaction.reply(`Hello!`));
|
|
146
153
|
|
|
147
154
|
new ContextMenuCommandBuilder()
|
|
148
|
-
.setName(
|
|
155
|
+
.setName("message-command")
|
|
149
156
|
.setDescription(`Your command`)
|
|
150
157
|
.setCooldown(1000 * 5) // 5 seconds cooldown
|
|
151
158
|
.setExecute(async ({ message }) => message.reply(`Hello!`));
|
|
152
159
|
|
|
153
160
|
new SlashCommandBuilder()
|
|
154
|
-
.setName(
|
|
161
|
+
.setName("slash-command")
|
|
155
162
|
.setDescription(`Your command`)
|
|
156
163
|
.setCooldown(1000 * 5) // 5 seconds cooldown
|
|
157
164
|
.setExecute(async ({ interaction }) => interaction.reply(`Hello!`));
|
|
@@ -187,7 +194,8 @@ Use env variable
|
|
|
187
194
|
npx reciple --token "env:TOKEN_VARIABLE"
|
|
188
195
|
```
|
|
189
196
|
|
|
190
|
-
|
|
197
|
+
---
|
|
191
198
|
|
|
192
199
|
> ## Fun Fact
|
|
200
|
+
>
|
|
193
201
|
> 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/bin/classes/Config.js
CHANGED
|
@@ -27,7 +27,7 @@ class Config {
|
|
|
27
27
|
let configYaml = (0, fallout_utility_1.replaceAll)(Config.defaultConfigYaml(), 'VERSION', client_1.version);
|
|
28
28
|
let configData = yaml_1.default.parse(configYaml);
|
|
29
29
|
if (configData.token === 'TOKEN') {
|
|
30
|
-
configData.token = await this.askToken() || 'TOKEN';
|
|
30
|
+
configData.token = cli_1.flags.token || await this.askToken() || 'TOKEN';
|
|
31
31
|
configYaml = (0, fallout_utility_1.replaceAll)(configYaml, 'token: TOKEN', `token: ${configData.token}`);
|
|
32
32
|
}
|
|
33
33
|
(0, fs_1.writeFileSync)(this.configPath, configYaml, 'utf-8');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Config.js","sourceRoot":"","sources":["../../src/classes/Config.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAgE;AAChE,qDAAmD;AACnD,2BAA6D;AAE7D,gDAAuB;AACvB,oDAA4B;AAC5B,sCAA0C;AAE1C,gBAAM,CAAC,MAAM,CAAC;IACV,IAAI,EAAE,WAAK,CAAC,GAAG,CAAC,CAAC,CAAC,sBAAI,CAAC,OAAO,CAAC,WAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,sBAAI,CAAC,IAAI,CAAC,SAAG,EAAE,MAAM,CAAC;CACrE,CAAC,CAAC;AAqBH,MAAa,MAAM;IACR,MAAM,CAAC,iBAAiB,GAAW,sBAAI,CAAC,IAAI,CAAC,SAAS,EAAE,yBAAyB,CAAC,CAAC;IACnF,MAAM,GAAiB,IAAI,CAAC;IAC1B,UAAU,CAAS;IAE5B,YAAY,UAAkB;QAC1B,IAAI,CAAC,UAAU;YAAE,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;QAC/D,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IACjC,CAAC;IAEM,KAAK,CAAC,WAAW;QACpB,IAAI,CAAC,IAAA,eAAU,EAAC,IAAI,CAAC,UAAU,CAAC,EAAE;YAC9B,IAAI,UAAU,GAAG,IAAA,4BAAU,EAAC,MAAM,CAAC,iBAAiB,EAAE,EAAE,SAAS,EAAE,gBAAO,CAAC,CAAC;YAC5E,IAAI,UAAU,GAAG,cAAG,CAAC,KAAK,CAAC,UAAU,CAAY,CAAC;YAElD,IAAI,UAAU,CAAC,KAAK,KAAK,OAAO,EAAE;gBAC9B,UAAU,CAAC,KAAK,GAAG,MAAM,IAAI,CAAC,QAAQ,EAAE,IAAI,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Config.js","sourceRoot":"","sources":["../../src/classes/Config.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAgE;AAChE,qDAAmD;AACnD,2BAA6D;AAE7D,gDAAuB;AACvB,oDAA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,CAAC,CAAC;IAC/C,CAAC;IAEM,MAAM,CAAC,iBAAiB;QAC3B,IAAI,CAAC,IAAA,eAAU,EAAC,IAAI,CAAC,iBAAiB,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,wCAAwC,IAAI,CAAC,iBAAiB,EAAE,CAAC,CAAC;QAC3H,OAAO,IAAA,iBAAY,EAAC,IAAI,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAC;IACzD,CAAC;;AA/DL,wBAgEC"}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "reciple",
|
|
3
3
|
"description": "Reciple is a Discord.js handler",
|
|
4
4
|
"license": "GPL-3.0",
|
|
5
|
-
"version": "7.0.0-dev.
|
|
5
|
+
"version": "7.0.0-dev.13",
|
|
6
6
|
"main": "./bin/index.js",
|
|
7
7
|
"module": "./bin/esm.mjs",
|
|
8
8
|
"types": "./bin/index.d.ts",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"scripts": {
|
|
18
18
|
"clean": "npx rimraf ./bin",
|
|
19
19
|
"build": "npm run clean && npx tsc",
|
|
20
|
-
"docs": "npx docgen -i ./
|
|
20
|
+
"docs": "npx docgen -i ./src/exports.ts -c ./docs/custom.json -o ./docs/docs.json --typescript"
|
|
21
21
|
},
|
|
22
22
|
"files": [
|
|
23
23
|
"bin",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@inquirer/confirm": "^0.0.28-alpha.0",
|
|
29
29
|
"@inquirer/password": "^0.0.28-alpha.0",
|
|
30
|
-
"@reciple/client": "^7.0.0-dev.
|
|
30
|
+
"@reciple/client": "^7.0.0-dev.9",
|
|
31
31
|
"chalk": "4.1.2",
|
|
32
32
|
"commander": "^10.0.0",
|
|
33
33
|
"dotenv": "^16.0.3",
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"discord.js": "^14.7.1"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "190d160c48716a7e702d0a7d7282674f20607e57"
|
|
47
47
|
}
|