reciple 7.0.0-dev.5 → 7.0.0-dev.7
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 +193 -0
- package/package.json +5 -4
package/README.md
ADDED
|
@@ -0,0 +1,193 @@
|
|
|
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://npmjs.org/package/reciple">
|
|
8
|
+
<img src="https://img.shields.io/npm/v/reciple?label=latest%20npm%20release%20">
|
|
9
|
+
</a>
|
|
10
|
+
<a href="https://github.com/FalloutStudios/Reciple/blob/main/LICENSE">
|
|
11
|
+
<img src="https://img.shields.io/github/license/FalloutStudios/Reciple">
|
|
12
|
+
</a>
|
|
13
|
+
<a href="https://www.codefactor.io/repository/github/falloutstudios/reciple/overview/main">
|
|
14
|
+
<img src="https://www.codefactor.io/repository/github/falloutstudios/reciple/badge/main">
|
|
15
|
+
</a>
|
|
16
|
+
|
|
17
|
+
A simple Dicord.js handler that just works.
|
|
18
|
+
</h3>
|
|
19
|
+
|
|
20
|
+
# Features
|
|
21
|
+
|
|
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
|
+
|
|
31
|
+
## Installation
|
|
32
|
+
|
|
33
|
+
To install the bot, run the following command in your terminal:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
npm i reciple discord.js
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
You can initialize the bot to the current directory with the following command in your terminal:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
npx reciple
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
It will ask you to continue if the directory is not empty. Type `y` to continue. After the bot has been initialized, it will ask you for your bot token.
|
|
46
|
+
|
|
47
|
+
> You can change the token anytime you want
|
|
48
|
+
|
|
49
|
+
## CLI usage
|
|
50
|
+
```yml
|
|
51
|
+
Usage: reciple [options] [cwd]
|
|
52
|
+
|
|
53
|
+
Reciple.js - Discord.js handler cli
|
|
54
|
+
|
|
55
|
+
Arguments:
|
|
56
|
+
cwd Change the current working directory
|
|
57
|
+
|
|
58
|
+
Options:
|
|
59
|
+
-v, --version output the version number
|
|
60
|
+
-t, --token <token> Replace used bot token
|
|
61
|
+
-c, --config <config> Change path to config file
|
|
62
|
+
-D, --debugmode Enable debug mode
|
|
63
|
+
-y, --yes Agree to all Reciple confirmation prompts
|
|
64
|
+
--env .env file location
|
|
65
|
+
-h, --help display help for command
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Message Commands
|
|
69
|
+
|
|
70
|
+
Reciple provides built-in `MessageCommandBuilder` class that can be used for message command handler.
|
|
71
|
+
|
|
72
|
+
```js
|
|
73
|
+
const { MessageCommandBuilder } = require('reciple');
|
|
74
|
+
|
|
75
|
+
new MessageCommandBuilder()
|
|
76
|
+
.setName("command")
|
|
77
|
+
.setDescription("Your lil tiny description")
|
|
78
|
+
.addAliases('cmd', 'cmd1')
|
|
79
|
+
.setExecute(command => command.message.reply("Hello!"))
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Validate Message Command Options
|
|
83
|
+
|
|
84
|
+
```js
|
|
85
|
+
const { MessageCommandBuilder } = require('reciple');
|
|
86
|
+
|
|
87
|
+
new MessageCommandBuilder()
|
|
88
|
+
.setName("command")
|
|
89
|
+
.setDescription("Your lil tiny description")
|
|
90
|
+
.addAliases('cmd', 'cmd1')
|
|
91
|
+
.setValidateOptions(true) // Validate options
|
|
92
|
+
.addOption(option => option
|
|
93
|
+
.setName("quantity")
|
|
94
|
+
.setDescription("Must be a number")
|
|
95
|
+
.setRequired(true) // A required option
|
|
96
|
+
.setValidator(val => !isNaN(Number(val))) // Validate value
|
|
97
|
+
)
|
|
98
|
+
.setExecute(async command => {
|
|
99
|
+
const quantity = Number(command.options.getValue('quantity', true));
|
|
100
|
+
|
|
101
|
+
await command.message.reply("Quantity: " + quantity);
|
|
102
|
+
})
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Context Menus
|
|
106
|
+
|
|
107
|
+
Reciple provides custom `ContextMenuBuilder` class that can be used for context menu command handler.
|
|
108
|
+
|
|
109
|
+
```js
|
|
110
|
+
const { ContextMenuBuilder } = require('reciple');
|
|
111
|
+
const { ApplicationCommandType } = require('discord.js');
|
|
112
|
+
|
|
113
|
+
new ContextMenuBuilder()
|
|
114
|
+
.setName('Ban')
|
|
115
|
+
.setType(ApplicationCommandType.User)
|
|
116
|
+
.setExecute(async ({ interaction }) => {
|
|
117
|
+
if (!interaction.inCachedGuild()) return;
|
|
118
|
+
await interaction.member.ban();
|
|
119
|
+
})
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Slash Commands
|
|
123
|
+
|
|
124
|
+
Reciple provides custom `SlashCommandBuilder` class that can be used for slash command handler.
|
|
125
|
+
|
|
126
|
+
```js
|
|
127
|
+
const { SlashCommandBuilder } = require('reciple');
|
|
128
|
+
|
|
129
|
+
new SlashCommandBuilder()
|
|
130
|
+
.setName('ping')
|
|
131
|
+
.setDescription('Pong')
|
|
132
|
+
.setExecute(async ({ interaction }) => interaction.reply(`Pong!`))
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Command Cooldowns
|
|
136
|
+
|
|
137
|
+
```js
|
|
138
|
+
const { MessageCommandBuilder, MessageCommandBuilder, SlashCommandBuilder } = require('reciple');
|
|
139
|
+
const { ApplicationCommandType } = require('discord.js');
|
|
140
|
+
|
|
141
|
+
new ContextMenuCommandBuilder()
|
|
142
|
+
.setName('Context Menu')
|
|
143
|
+
.setType(ApplicationCommandType.Message)
|
|
144
|
+
.setCooldown(1000 * 5) // 5 seconds cooldown
|
|
145
|
+
.setExecute(async ({ interaction }) => interaction.reply(`Hello!`));
|
|
146
|
+
|
|
147
|
+
new ContextMenuCommandBuilder()
|
|
148
|
+
.setName('message-command')
|
|
149
|
+
.setDescription(`Your command`)
|
|
150
|
+
.setCooldown(1000 * 5) // 5 seconds cooldown
|
|
151
|
+
.setExecute(async ({ message }) => message.reply(`Hello!`));
|
|
152
|
+
|
|
153
|
+
new SlashCommandBuilder()
|
|
154
|
+
.setName('slash-command')
|
|
155
|
+
.setDescription(`Your command`)
|
|
156
|
+
.setCooldown(1000 * 5) // 5 seconds cooldown
|
|
157
|
+
.setExecute(async ({ interaction }) => interaction.reply(`Hello!`));
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## Config
|
|
161
|
+
|
|
162
|
+
You can configure the bot in `reciple.yml` located in the bot's root directory.
|
|
163
|
+
|
|
164
|
+
### Token
|
|
165
|
+
|
|
166
|
+
You can directly change the token in `reciple.yml`.
|
|
167
|
+
|
|
168
|
+
```yml
|
|
169
|
+
token: "YOUR_TOKEN_HERE"
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
Using environment variables is also supported.
|
|
173
|
+
|
|
174
|
+
```yml
|
|
175
|
+
token: "env:TOKEN_VARIABLE"
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
You can override the given token using your terminal
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
npx reciple --token "YOUR_TOKEN_HERE"
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
Use env variable
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
npx reciple --token "env:TOKEN_VARIABLE"
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
***
|
|
191
|
+
|
|
192
|
+
> ## Fun Fact
|
|
193
|
+
> 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/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.7",
|
|
6
6
|
"main": "./bin/index.js",
|
|
7
7
|
"module": "./bin/esm.mjs",
|
|
8
8
|
"types": "./bin/index.d.ts",
|
|
@@ -20,12 +20,13 @@
|
|
|
20
20
|
},
|
|
21
21
|
"files": [
|
|
22
22
|
"bin",
|
|
23
|
-
"static"
|
|
23
|
+
"static",
|
|
24
|
+
"README.md"
|
|
24
25
|
],
|
|
25
26
|
"dependencies": {
|
|
26
27
|
"@inquirer/confirm": "^0.0.28-alpha.0",
|
|
27
28
|
"@inquirer/password": "^0.0.28-alpha.0",
|
|
28
|
-
"@reciple/client": "^7.0.0-dev.
|
|
29
|
+
"@reciple/client": "^7.0.0-dev.3",
|
|
29
30
|
"chalk": "4.1.2",
|
|
30
31
|
"commander": "^10.0.0",
|
|
31
32
|
"dotenv": "^16.0.3",
|
|
@@ -41,5 +42,5 @@
|
|
|
41
42
|
"peerDependencies": {
|
|
42
43
|
"discord.js": "^14.7.1"
|
|
43
44
|
},
|
|
44
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "aa8959bfc49c30a8892f5c17a5236ad4bb07c7be"
|
|
45
46
|
}
|