reciple 4.0.0-pre.3 → 4.0.0-pre.4
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/bin/bin.js +10 -11
- package/bin/reciple/classes/RecipleClient.js +1 -1
- package/bin/reciple/flags.js +5 -1
- package/bin/reciple/version.d.ts +4 -0
- package/bin/reciple/version.js +5 -1
- package/package.json +2 -2
package/bin/bin.js
CHANGED
|
@@ -12,7 +12,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
12
12
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
13
13
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
14
14
|
};
|
|
15
|
-
var _a, _b, _c;
|
|
15
|
+
var _a, _b, _c, _d;
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
const RecipleClient_1 = require("./reciple/classes/RecipleClient");
|
|
18
18
|
const RecipleConfig_1 = require("./reciple/classes/RecipleConfig");
|
|
@@ -22,19 +22,15 @@ const chalk_1 = __importDefault(require("chalk"));
|
|
|
22
22
|
const fallout_utility_1 = require("fallout-utility");
|
|
23
23
|
const fs_1 = require("fs");
|
|
24
24
|
require("dotenv/config");
|
|
25
|
-
if (flags_1.flags.version) {
|
|
26
|
-
console.log(`v${version_1.version}`);
|
|
27
|
-
process.exit(0);
|
|
28
|
-
}
|
|
29
25
|
const allowedFiles = ['node_modules', 'reciple.yml', 'package.json'];
|
|
30
26
|
if ((0, fs_1.readdirSync)('./').filter(f => !f.startsWith('.') && allowedFiles.indexOf(f)).length > 0 && !(0, fs_1.existsSync)((_a = flags_1.flags.config) !== null && _a !== void 0 ? _a : './reciple.yml')) {
|
|
31
|
-
const ask = (_b = (0, fallout_utility_1.input)('This directory does not contain reciple.yml. Would you like to init axis here? [y/n] ')) !== null &&
|
|
27
|
+
const ask = (_c = (_b = (flags_1.flags.yes ? 'y' : null)) !== null && _b !== void 0 ? _b : (0, fallout_utility_1.input)('This directory does not contain reciple.yml. Would you like to init axis here? [y/n] ')) !== null && _c !== void 0 ? _c : '';
|
|
32
28
|
if (ask.toString().toLowerCase() !== 'y')
|
|
33
29
|
process.exit(0);
|
|
34
30
|
}
|
|
35
31
|
let configParser;
|
|
36
32
|
try {
|
|
37
|
-
configParser = new RecipleConfig_1.RecipleConfig((
|
|
33
|
+
configParser = new RecipleConfig_1.RecipleConfig((_d = flags_1.flags.config) !== null && _d !== void 0 ? _d : './reciple.yml').parseConfig();
|
|
38
34
|
}
|
|
39
35
|
catch (err) {
|
|
40
36
|
console.error(`${chalk_1.default.bold.red('Config Error')}: ${chalk_1.default.white(err.message)}`);
|
|
@@ -43,15 +39,18 @@ catch (err) {
|
|
|
43
39
|
const config = configParser.getConfig();
|
|
44
40
|
const client = new RecipleClient_1.RecipleClient(Object.assign({ config: config }, config.client));
|
|
45
41
|
if (config.fileLogging.clientLogs)
|
|
46
|
-
client.logger.info('Reciple Client v' + version_1.
|
|
42
|
+
client.logger.info('Reciple Client v' + version_1.rawVersion + ' is starting...');
|
|
47
43
|
(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
48
44
|
yield client.startModules();
|
|
49
45
|
client.on('ready', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
50
|
-
var
|
|
46
|
+
var _e;
|
|
51
47
|
if (client.isClientLogsEnabled())
|
|
52
|
-
client.logger.warn(`Logged in as ${((
|
|
48
|
+
client.logger.warn(`Logged in as ${((_e = client.user) === null || _e === void 0 ? void 0 : _e.tag) || 'Unknown'}!`);
|
|
53
49
|
yield client.loadModules();
|
|
54
50
|
client.addCommandListeners();
|
|
55
51
|
}));
|
|
56
|
-
client.login(config.token)
|
|
52
|
+
client.login(config.token).catch(err => {
|
|
53
|
+
if (client.isClientLogsEnabled())
|
|
54
|
+
client.logger.error(err);
|
|
55
|
+
});
|
|
57
56
|
}))();
|
|
@@ -40,7 +40,7 @@ class RecipleClient extends discord_js_1.Client {
|
|
|
40
40
|
this.commandCooldowns = new CommandCooldownManager_1.CommandCooldownManager();
|
|
41
41
|
this.modules = [];
|
|
42
42
|
this.version = version_1.version;
|
|
43
|
-
this.logger = (0, logger_1.createLogger)(!!((_a = options.config) === null || _a === void 0 ? void 0 : _a.fileLogging.stringifyLoggedJSON),
|
|
43
|
+
this.logger = (0, logger_1.createLogger)(!!((_a = options.config) === null || _a === void 0 ? void 0 : _a.fileLogging.stringifyLoggedJSON), (_b = options.config) === null || _b === void 0 ? void 0 : _b.fileLogging.debugmode);
|
|
44
44
|
if (!options.config)
|
|
45
45
|
throw new Error('Config is not defined.');
|
|
46
46
|
this.config = Object.assign(Object.assign({}, this.config), ((_c = options.config) !== null && _c !== void 0 ? _c : {}));
|
package/bin/reciple/flags.js
CHANGED
|
@@ -5,10 +5,14 @@ const commander_1 = require("commander");
|
|
|
5
5
|
/**
|
|
6
6
|
* Used flags
|
|
7
7
|
*/
|
|
8
|
-
exports.flags = commander_1.
|
|
8
|
+
exports.flags = new commander_1.Command()
|
|
9
|
+
.name('reciple')
|
|
10
|
+
.description('Reciple.js - Discord.js handler cli')
|
|
11
|
+
.version(`v${require('../../package.json').version}`, '-v, --version')
|
|
9
12
|
.option('-t, --token <token>', 'Replace used bot token')
|
|
10
13
|
.option('-c, --config <config>', 'Change path to config file')
|
|
11
14
|
.option('-D, --debugmode', 'Enabled debug mode')
|
|
15
|
+
.option('-y, --yes', 'Automatically agree to Reciple confirmation prompts')
|
|
12
16
|
.option('-v, --version', 'Display version')
|
|
13
17
|
.parse().opts();
|
|
14
18
|
/**
|
package/bin/reciple/version.d.ts
CHANGED
|
@@ -3,6 +3,10 @@ import semver from 'semver';
|
|
|
3
3
|
* Current reciple version
|
|
4
4
|
*/
|
|
5
5
|
export declare const version: string;
|
|
6
|
+
/**
|
|
7
|
+
* Current reciple version from package.json
|
|
8
|
+
*/
|
|
9
|
+
export declare const rawVersion: any;
|
|
6
10
|
/**
|
|
7
11
|
* Check if the version is valid
|
|
8
12
|
* @param ver Version string to validated
|
package/bin/reciple/version.js
CHANGED
|
@@ -3,12 +3,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.isSupportedVersion = exports.parseVersion = exports.isValidVersion = exports.version = void 0;
|
|
6
|
+
exports.isSupportedVersion = exports.parseVersion = exports.isValidVersion = exports.rawVersion = exports.version = void 0;
|
|
7
7
|
const semver_1 = __importDefault(require("semver"));
|
|
8
8
|
/**
|
|
9
9
|
* Current reciple version
|
|
10
10
|
*/
|
|
11
11
|
exports.version = `${semver_1.default.coerce(require('../../package.json').version)}`;
|
|
12
|
+
/**
|
|
13
|
+
* Current reciple version from package.json
|
|
14
|
+
*/
|
|
15
|
+
exports.rawVersion = require('../../package.json').version;
|
|
12
16
|
/**
|
|
13
17
|
* Check if the version is valid
|
|
14
18
|
* @param ver Version string to validated
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "reciple",
|
|
3
|
-
"version": "4.0.0-pre.
|
|
3
|
+
"version": "4.0.0-pre.4",
|
|
4
4
|
"bin": "bin/bin.js",
|
|
5
5
|
"license": "GPL-3.0",
|
|
6
6
|
"main": "bin/index.js",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"clean": "yarn exec rimraf bin",
|
|
23
23
|
"build": "yarn clean && yarn exec tsc",
|
|
24
24
|
"build:publish": "yarn build && yarn npm publish && yarn build:docs && yarn publish:docs",
|
|
25
|
-
"build:
|
|
25
|
+
"build:publish-prerelease": "yarn build && yarn npm publish --tag pre",
|
|
26
26
|
"build:docs": "yarn exec typedoc --tsconfig ./docs/typedoc.json",
|
|
27
27
|
"update:docs": "yarn workspace docs update",
|
|
28
28
|
"test": "yarn build && yarn test:start",
|