reciple 7.0.0-dev.8 → 7.0.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 +57 -39
- package/bin/bin.mjs +15 -7
- package/bin/bin.mjs.map +1 -1
- package/bin/classes/Config.js +7 -5
- package/bin/classes/Config.js.map +1 -1
- package/bin/exports.d.ts +4 -0
- package/bin/exports.js +21 -0
- package/bin/exports.js.map +1 -0
- package/bin/index.d.ts +1 -4
- package/bin/index.js +1 -4
- package/bin/index.js.map +1 -1
- package/bin/utils/cli.js +3 -1
- package/bin/utils/cli.js.map +1 -1
- package/package.json +8 -6
package/README.md
CHANGED
|
@@ -13,24 +13,34 @@
|
|
|
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
|
+
## Install From Templates
|
|
32
32
|
|
|
33
|
-
To
|
|
33
|
+
To use templates use the following command in your terminal:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
npm create reciple@latest
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
After that configure the template you want to use.
|
|
40
|
+
|
|
41
|
+
## Manual Installation
|
|
42
|
+
|
|
43
|
+
To install the handler, run the following command in your terminal:
|
|
34
44
|
|
|
35
45
|
```bash
|
|
36
46
|
npm i reciple discord.js
|
|
@@ -47,6 +57,7 @@ It will ask you to continue if the directory is not empty. Type `y` to continue.
|
|
|
47
57
|
> You can change the token anytime you want
|
|
48
58
|
|
|
49
59
|
## CLI usage
|
|
60
|
+
|
|
50
61
|
```yml
|
|
51
62
|
Usage: reciple [options] [cwd]
|
|
52
63
|
|
|
@@ -70,36 +81,38 @@ Options:
|
|
|
70
81
|
Reciple provides built-in `MessageCommandBuilder` class that can be used for message command handler.
|
|
71
82
|
|
|
72
83
|
```js
|
|
73
|
-
const { MessageCommandBuilder } = require(
|
|
84
|
+
const { MessageCommandBuilder } = require("reciple");
|
|
74
85
|
|
|
75
86
|
new MessageCommandBuilder()
|
|
76
87
|
.setName("command")
|
|
77
88
|
.setDescription("Your lil tiny description")
|
|
78
|
-
.addAliases(
|
|
79
|
-
.setExecute(command => command.message.reply("Hello!"))
|
|
89
|
+
.addAliases("cmd", "cmd1")
|
|
90
|
+
.setExecute((command) => command.message.reply("Hello!"));
|
|
80
91
|
```
|
|
81
92
|
|
|
82
93
|
### Validate Message Command Options
|
|
83
94
|
|
|
84
95
|
```js
|
|
85
|
-
const { MessageCommandBuilder } = require(
|
|
96
|
+
const { MessageCommandBuilder } = require("reciple");
|
|
86
97
|
|
|
87
98
|
new MessageCommandBuilder()
|
|
88
99
|
.setName("command")
|
|
89
100
|
.setDescription("Your lil tiny description")
|
|
90
|
-
.addAliases(
|
|
101
|
+
.addAliases("cmd", "cmd1")
|
|
91
102
|
.setValidateOptions(true) // Validate options
|
|
92
|
-
.addOption(
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
103
|
+
.addOption(
|
|
104
|
+
(option) =>
|
|
105
|
+
option
|
|
106
|
+
.setName("quantity")
|
|
107
|
+
.setDescription("Must be a number")
|
|
108
|
+
.setRequired(true) // A required option
|
|
109
|
+
.setValidator((val) => !isNaN(Number(val))) // Validate value
|
|
97
110
|
)
|
|
98
|
-
.setExecute(async command => {
|
|
99
|
-
const quantity = Number(command.options.getValue(
|
|
111
|
+
.setExecute(async (command) => {
|
|
112
|
+
const quantity = Number(command.options.getValue("quantity", true));
|
|
100
113
|
|
|
101
114
|
await command.message.reply("Quantity: " + quantity);
|
|
102
|
-
})
|
|
115
|
+
});
|
|
103
116
|
```
|
|
104
117
|
|
|
105
118
|
## Context Menus
|
|
@@ -107,16 +120,16 @@ new MessageCommandBuilder()
|
|
|
107
120
|
Reciple provides custom `ContextMenuBuilder` class that can be used for context menu command handler.
|
|
108
121
|
|
|
109
122
|
```js
|
|
110
|
-
const { ContextMenuBuilder } = require(
|
|
111
|
-
const { ApplicationCommandType } = require(
|
|
123
|
+
const { ContextMenuBuilder } = require("reciple");
|
|
124
|
+
const { ApplicationCommandType } = require("discord.js");
|
|
112
125
|
|
|
113
126
|
new ContextMenuBuilder()
|
|
114
|
-
.setName(
|
|
127
|
+
.setName("Ban")
|
|
115
128
|
.setType(ApplicationCommandType.User)
|
|
116
129
|
.setExecute(async ({ interaction }) => {
|
|
117
130
|
if (!interaction.inCachedGuild()) return;
|
|
118
131
|
await interaction.member.ban();
|
|
119
|
-
})
|
|
132
|
+
});
|
|
120
133
|
```
|
|
121
134
|
|
|
122
135
|
## Slash Commands
|
|
@@ -124,34 +137,38 @@ new ContextMenuBuilder()
|
|
|
124
137
|
Reciple provides custom `SlashCommandBuilder` class that can be used for slash command handler.
|
|
125
138
|
|
|
126
139
|
```js
|
|
127
|
-
const { SlashCommandBuilder } = require(
|
|
140
|
+
const { SlashCommandBuilder } = require("reciple");
|
|
128
141
|
|
|
129
142
|
new SlashCommandBuilder()
|
|
130
|
-
.setName(
|
|
131
|
-
.setDescription(
|
|
132
|
-
.setExecute(async ({ interaction }) => interaction.reply(`Pong!`))
|
|
143
|
+
.setName("ping")
|
|
144
|
+
.setDescription("Pong")
|
|
145
|
+
.setExecute(async ({ interaction }) => interaction.reply(`Pong!`));
|
|
133
146
|
```
|
|
134
147
|
|
|
135
148
|
## Command Cooldowns
|
|
136
149
|
|
|
137
150
|
```js
|
|
138
|
-
const {
|
|
139
|
-
|
|
151
|
+
const {
|
|
152
|
+
MessageCommandBuilder,
|
|
153
|
+
MessageCommandBuilder,
|
|
154
|
+
SlashCommandBuilder,
|
|
155
|
+
} = require("reciple");
|
|
156
|
+
const { ApplicationCommandType } = require("discord.js");
|
|
140
157
|
|
|
141
158
|
new ContextMenuCommandBuilder()
|
|
142
|
-
.setName(
|
|
159
|
+
.setName("Context Menu")
|
|
143
160
|
.setType(ApplicationCommandType.Message)
|
|
144
161
|
.setCooldown(1000 * 5) // 5 seconds cooldown
|
|
145
162
|
.setExecute(async ({ interaction }) => interaction.reply(`Hello!`));
|
|
146
163
|
|
|
147
164
|
new ContextMenuCommandBuilder()
|
|
148
|
-
.setName(
|
|
165
|
+
.setName("message-command")
|
|
149
166
|
.setDescription(`Your command`)
|
|
150
167
|
.setCooldown(1000 * 5) // 5 seconds cooldown
|
|
151
168
|
.setExecute(async ({ message }) => message.reply(`Hello!`));
|
|
152
169
|
|
|
153
170
|
new SlashCommandBuilder()
|
|
154
|
-
.setName(
|
|
171
|
+
.setName("slash-command")
|
|
155
172
|
.setDescription(`Your command`)
|
|
156
173
|
.setCooldown(1000 * 5) // 5 seconds cooldown
|
|
157
174
|
.setExecute(async ({ interaction }) => interaction.reply(`Hello!`));
|
|
@@ -187,7 +204,8 @@ Use env variable
|
|
|
187
204
|
npx reciple --token "env:TOKEN_VARIABLE"
|
|
188
205
|
```
|
|
189
206
|
|
|
190
|
-
|
|
207
|
+
---
|
|
191
208
|
|
|
192
209
|
> ## Fun Fact
|
|
210
|
+
>
|
|
193
211
|
> 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/bin.mjs
CHANGED
|
@@ -3,29 +3,37 @@ import { existsSync, mkdirSync, readdirSync } from 'fs';
|
|
|
3
3
|
import { flags, cwd } from './utils/cli.js';
|
|
4
4
|
import { path } from 'fallout-utility';
|
|
5
5
|
import micromatch from 'micromatch';
|
|
6
|
-
import
|
|
6
|
+
import prompts from 'prompts';
|
|
7
7
|
import { Config } from './classes/Config.js';
|
|
8
|
-
import { ContextMenuCommandBuilder, MessageCommandBuilder, RecipleClient, SlashCommandBuilder, realVersion } from '@reciple/client';
|
|
8
|
+
import { ContextMenuCommandBuilder, MessageCommandBuilder, RecipleClient, SlashCommandBuilder, realVersion, version } from '@reciple/client';
|
|
9
9
|
import { createLogger, eventLogger } from './utils/logger.js';
|
|
10
10
|
import { getModules } from './utils/modules.js';
|
|
11
|
+
import semver from 'semver';
|
|
11
12
|
const allowedFiles = ['node_modules', 'reciple.yml', 'package.json', '.*'];
|
|
12
13
|
const configPath = flags.config ?? path.join(cwd, 'reciple.yml');
|
|
13
14
|
if (!existsSync(cwd))
|
|
14
15
|
mkdirSync(cwd, { recursive: true });
|
|
15
16
|
if (readdirSync(cwd).filter(f => !micromatch.isMatch(f, allowedFiles)).length && !existsSync(configPath) && !flags.yes) {
|
|
16
|
-
const confirm = await
|
|
17
|
-
|
|
18
|
-
message:
|
|
17
|
+
const confirm = await prompts({
|
|
18
|
+
initial: false,
|
|
19
|
+
message: `Would you like to create Reciple instance ${cwd !== process.cwd() ? 'in your chosen directory' : 'here'}?`,
|
|
20
|
+
name: 'confirm',
|
|
21
|
+
type: 'confirm'
|
|
19
22
|
});
|
|
20
|
-
if (!confirm)
|
|
23
|
+
if (!confirm.confirm)
|
|
21
24
|
process.exit(0);
|
|
22
25
|
}
|
|
23
26
|
const configParser = await (new Config(configPath)).parseConfig();
|
|
24
27
|
const config = configParser.getConfig();
|
|
28
|
+
const logger = config.logger.enabled ? createLogger(config.logger) : undefined;
|
|
29
|
+
if (!semver.satisfies(version, config.version)) {
|
|
30
|
+
logger?.error(`Your config version doesn't support Reciple client v${version}`);
|
|
31
|
+
process.exit(1);
|
|
32
|
+
}
|
|
25
33
|
const client = new RecipleClient({
|
|
26
34
|
recipleOptions: config,
|
|
27
35
|
...config.client,
|
|
28
|
-
logger
|
|
36
|
+
logger
|
|
29
37
|
});
|
|
30
38
|
client.logger?.info(`Starting Reciple client v${realVersion} - ${new Date()}`);
|
|
31
39
|
eventLogger(client);
|
package/bin/bin.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bin.mjs","sourceRoot":"","sources":["../src/bin.mts"],"names":[],"mappings":";AAEA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,IAAI,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,
|
|
1
|
+
{"version":3,"file":"bin.mjs","sourceRoot":"","sources":["../src/bin.mts"],"names":[],"mappings":";AAEA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,IAAI,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,yBAAyB,EAAE,qBAAqB,EAAE,aAAa,EAAE,mBAAmB,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC7I,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;A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AAM,CAAC,MAAM,EAAE,GAAG,CAAC,UAAU,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAC,IAAI,mBAAmB,CAAC,CAAC;IACtF,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,UAAU,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,iBAAiB,CAAC,CAAC;IAElF,MAAM,CAAC,EAAE,CAAC,mBAAmB,EAAE,WAAW,CAAC,EAAE;QACzC,IAAI,WAAW,CAAC,oBAAoB,EAAE,EAAE;YACpC,yBAAyB,CAAC,OAAO,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;SAC1D;aAAM,IAAI,WAAW,CAAC,kBAAkB,EAAE,EAAE;YACzC,mBAAmB,CAAC,OAAO,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;SACpD;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,eAAe,EAAE,OAAO,CAAC,EAAE;QACjC,qBAAqB,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnD,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC;AAEH,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC"}
|
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');
|
|
@@ -44,11 +44,13 @@ class Config {
|
|
|
44
44
|
return this.config;
|
|
45
45
|
}
|
|
46
46
|
async askToken() {
|
|
47
|
-
return (await import('
|
|
48
|
-
|
|
47
|
+
return (await (await import('prompts')).default({
|
|
48
|
+
name: 'token',
|
|
49
|
+
type: 'password',
|
|
49
50
|
mask: '*',
|
|
50
|
-
|
|
51
|
-
|
|
51
|
+
message: 'Bot token:',
|
|
52
|
+
validate: value => !value.length ? `Enter a valid bot token` : true
|
|
53
|
+
})).token;
|
|
52
54
|
}
|
|
53
55
|
parseToken() {
|
|
54
56
|
let token = cli_1.flags.token || this.config?.token || null;
|
|
@@ -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,iBAAi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EAAE,KAAK,IAAI,IAAI,CAAC;QACtD,IAAI,CAAC,KAAK;YAAE,OAAO,KAAK,CAAC;QAEzB,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACrC,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,KAAK,KAAK;YAAE,OAAO,KAAK,CAAC;QAErE,OAAO,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;IACvC,CAAC;IAEM,MAAM,CAAC,aAAa;QACvB,OAAO,cAAG,CAAC,KAAK,CAAC,IAAI,CAAC,iBAAiB,EAAE,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;;AAjEL,wBAkEC"}
|
package/bin/exports.d.ts
ADDED
package/bin/exports.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./classes/Config"), exports);
|
|
18
|
+
__exportStar(require("./utils/cli"), exports);
|
|
19
|
+
__exportStar(require("./utils/logger"), exports);
|
|
20
|
+
__exportStar(require("./utils/modules"), exports);
|
|
21
|
+
//# sourceMappingURL=exports.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exports.js","sourceRoot":"","sources":["../src/exports.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC;AACjC,8CAA4B;AAC5B,iDAA+B;AAC/B,kDAAgC"}
|
package/bin/index.d.ts
CHANGED
package/bin/index.js
CHANGED
|
@@ -15,8 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("@reciple/client"), exports);
|
|
18
|
-
__exportStar(require("./
|
|
19
|
-
__exportStar(require("./utils/cli"), exports);
|
|
20
|
-
__exportStar(require("./utils/logger"), exports);
|
|
21
|
-
__exportStar(require("./utils/modules"), exports);
|
|
18
|
+
__exportStar(require("./exports"), exports);
|
|
22
19
|
//# sourceMappingURL=index.js.map
|
package/bin/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,4CAA0B"}
|
package/bin/utils/cli.js
CHANGED
|
@@ -4,10 +4,12 @@ exports.cwd = exports.flags = exports.command = void 0;
|
|
|
4
4
|
const client_1 = require("@reciple/client");
|
|
5
5
|
const commander_1 = require("commander");
|
|
6
6
|
const fallout_utility_1 = require("fallout-utility");
|
|
7
|
+
const fs_1 = require("fs");
|
|
8
|
+
const { version } = JSON.parse((0, fs_1.readFileSync)(fallout_utility_1.path.join(__dirname, '../../package.json'), 'utf-8'));
|
|
7
9
|
exports.command = new commander_1.Command()
|
|
8
10
|
.name('reciple')
|
|
9
11
|
.description('Reciple.js - Discord.js handler cli')
|
|
10
|
-
.version(`
|
|
12
|
+
.version(`Reciple CLI: ${version}\nReciple Client: ${client_1.realVersion}`, '-v, --version')
|
|
11
13
|
.argument('[cwd]', 'Change the current working directory')
|
|
12
14
|
.option('-t, --token <token>', 'Replace used bot token')
|
|
13
15
|
.option('-c, --config <config>', 'Change path to config file')
|
package/bin/utils/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/utils/cli.ts"],"names":[],"mappings":";;;AAAA,4CAA8C;AAC9C,yCAAoC;AACpC,qDAAuC;
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/utils/cli.ts"],"names":[],"mappings":";;;AAAA,4CAA8C;AAC9C,yCAAoC;AACpC,qDAAuC;AACvC,2BAAkC;AAElC,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,IAAA,iBAAY,EAAC,sBAAI,CAAC,IAAI,CAAC,SAAS,EAAE,oBAAoB,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC;AAErF,QAAA,OAAO,GAAG,IAAI,mBAAO,EAAE;KAC/B,IAAI,CAAC,SAAS,CAAC;KACf,WAAW,CAAC,qCAAqC,CAAC;KAClD,OAAO,CAAC,gBAAgB,OAAO,qBAAqB,oBAAW,EAAE,EAAE,eAAe,CAAC;KACnF,QAAQ,CAAC,OAAO,EAAE,sCAAsC,CAAC;KACzD,MAAM,CAAC,qBAAqB,EAAE,wBAAwB,CAAC;KACvD,MAAM,CAAC,uBAAuB,EAAE,4BAA4B,CAAC;KAC7D,MAAM,CAAC,iBAAiB,EAAE,mBAAmB,CAAC;KAC9C,MAAM,CAAC,WAAW,EAAE,2CAA2C,CAAC;KAChE,MAAM,CAAC,OAAO,EAAE,oBAAoB,CAAC;KACrC,KAAK,EAAE,CAAC;AAEA,QAAA,KAAK,GAAG,eAAO,CAAC,IAAI,EAAE,CAAC;AACvB,QAAA,GAAG,GAAG,eAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,sBAAI,CAAC,OAAO,CAAC,eAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC"}
|
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
|
|
5
|
+
"version": "7.0.0",
|
|
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 ./src
|
|
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",
|
|
@@ -25,23 +25,25 @@
|
|
|
25
25
|
"README.md"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@
|
|
29
|
-
"@inquirer/password": "^0.0.28-alpha.0",
|
|
30
|
-
"@reciple/client": "^7.0.0-dev.4",
|
|
28
|
+
"@reciple/client": "^7.0.0",
|
|
31
29
|
"chalk": "4.1.2",
|
|
32
30
|
"commander": "^10.0.0",
|
|
33
31
|
"dotenv": "^16.0.3",
|
|
34
32
|
"fallout-utility": "^2.1.3",
|
|
35
33
|
"globby": "^13.1.3",
|
|
36
34
|
"micromatch": "^4.0.5",
|
|
35
|
+
"prompts": "^2.4.2",
|
|
36
|
+
"semver": "^7.3.8",
|
|
37
37
|
"yaml": "^2.2.1"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@types/micromatch": "^4.0.2",
|
|
41
|
+
"@types/prompts": "^2.4.2",
|
|
42
|
+
"@types/semver": "^7.3.13",
|
|
41
43
|
"discord.js": "^14.7.1"
|
|
42
44
|
},
|
|
43
45
|
"peerDependencies": {
|
|
44
46
|
"discord.js": "^14.7.1"
|
|
45
47
|
},
|
|
46
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "6fd6a5b591314974f287ef9e98ae34bfb79bc24e"
|
|
47
49
|
}
|