reciple 6.0.0-dev.10 → 6.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/dist/lib/bin.mjs +53 -0
- package/dist/lib/esm.mjs +1 -0
- package/dist/{cjs → lib}/index.js +18 -17
- package/dist/{cjs → lib}/reciple/classes/RecipleClient.js +2 -2
- package/dist/{cjs → lib}/reciple/classes/RecipleConfig.js +4 -4
- package/dist/{cjs → lib}/reciple/classes/RecipleModule.js +0 -0
- package/dist/{cjs → lib}/reciple/classes/builders/MessageCommandBuilder.js +0 -0
- package/dist/{cjs → lib}/reciple/classes/builders/MessageCommandOptionBuilder.js +0 -0
- package/dist/{cjs → lib}/reciple/classes/builders/SlashCommandBuilder.js +0 -0
- package/dist/{cjs → lib}/reciple/classes/managers/ApplicationCommandManager.js +0 -0
- package/dist/{cjs → lib}/reciple/classes/managers/ClientCommandManager.js +0 -0
- package/dist/{cjs → lib}/reciple/classes/managers/ClientModuleManager.js +5 -28
- package/dist/{cjs → lib}/reciple/classes/managers/CommandCooldownManager.js +0 -0
- package/dist/{cjs → lib}/reciple/classes/managers/MessageCommandOptionManager.js +0 -0
- package/dist/{cjs → lib}/reciple/flags.js +2 -2
- package/dist/{cjs → lib}/reciple/permissions.js +0 -0
- package/dist/{cjs → lib}/reciple/types/builders.js +0 -0
- package/dist/{cjs → lib}/reciple/types/commands.js +0 -0
- package/dist/{cjs → lib}/reciple/types/paramOptions.js +0 -0
- package/dist/{cjs → lib}/reciple/util.js +0 -0
- package/dist/{cjs → lib}/reciple/version.js +0 -1
- package/dist/types/{bin.d.ts → bin.d.mts} +0 -0
- package/dist/types/esm.d.mts +1 -0
- package/dist/types/index.d.ts +18 -17
- package/dist/types/reciple/classes/managers/ClientModuleManager.d.ts +3 -3
- package/dist/types/reciple/types/paramOptions.d.ts +6 -1
- package/package.json +19 -13
- package/dist/cjs/bin.js +0 -54
package/dist/lib/bin.mjs
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { RecipleClient } from './reciple/classes/RecipleClient.js';
|
|
3
|
+
import { RecipleConfig } from './reciple/classes/RecipleConfig.js';
|
|
4
|
+
import { rawVersion } from './reciple/version.js';
|
|
5
|
+
import { existsSync, readdirSync } from 'fs';
|
|
6
|
+
import { cwd, flags } from './reciple/flags.js';
|
|
7
|
+
import { input } from 'fallout-utility';
|
|
8
|
+
import chalk from 'chalk';
|
|
9
|
+
import 'dotenv/config';
|
|
10
|
+
import path from 'path';
|
|
11
|
+
import { inspect } from 'util';
|
|
12
|
+
const allowedFiles = ['node_modules', 'reciple.yml', 'package.json'];
|
|
13
|
+
const configPath = path.join(cwd, './reciple.yml');
|
|
14
|
+
if (readdirSync(cwd).filter(f => !f.startsWith('.') && allowedFiles.indexOf(f)).length > 0 && !existsSync(flags.config ?? configPath)) {
|
|
15
|
+
const ask = (flags.yes ? 'y' : null) ?? input('This directory does not contain reciple.yml. Would you like to init axis here? [y/n] ') ?? '';
|
|
16
|
+
if (ask.toString().toLowerCase() !== 'y')
|
|
17
|
+
process.exit(0);
|
|
18
|
+
}
|
|
19
|
+
let configParser;
|
|
20
|
+
try {
|
|
21
|
+
configParser = new RecipleConfig(flags.config ?? configPath).parseConfig();
|
|
22
|
+
}
|
|
23
|
+
catch (err) {
|
|
24
|
+
console.error(`${chalk.bold.red('Config Error')}: ${inspect(err)}`);
|
|
25
|
+
process.exit(1);
|
|
26
|
+
}
|
|
27
|
+
const config = configParser.getConfig();
|
|
28
|
+
const client = new RecipleClient({ config: config, ...config.client });
|
|
29
|
+
/**
|
|
30
|
+
* Start
|
|
31
|
+
*/
|
|
32
|
+
if (!client.isClientLogsSilent)
|
|
33
|
+
client.logger.info('Starting Reciple client v' + rawVersion);
|
|
34
|
+
client.addCommandListeners();
|
|
35
|
+
await client.modules.startModules(await client.modules.getModulesFromFiles({
|
|
36
|
+
files: await client.modules.getModulePaths({
|
|
37
|
+
filter: file => file.endsWith('.js') || file.endsWith('.cjs') || file.endsWith('.mjs'),
|
|
38
|
+
}),
|
|
39
|
+
}));
|
|
40
|
+
client.on('ready', async () => {
|
|
41
|
+
await client.modules.loadModules(client.modules.modules.toJSON(), true);
|
|
42
|
+
if (!client.isClientLogsSilent)
|
|
43
|
+
client.logger.log(`Loaded ${client.commands.slashCommands.size} slash commands`, `Loaded ${client.commands.messageCommands.size} message commands`);
|
|
44
|
+
if (client.config.commands.slashCommand.registerCommands)
|
|
45
|
+
await client.commands.registerApplicationCommands();
|
|
46
|
+
if (!client.isClientLogsSilent)
|
|
47
|
+
client.logger.warn(`Logged in as ${client.user?.tag || 'Unknown'}!`);
|
|
48
|
+
client.on('cacheSweep', () => client.cooldowns.clean());
|
|
49
|
+
});
|
|
50
|
+
client.login(config.token).catch(err => {
|
|
51
|
+
if (!client.isClientLogsSilent)
|
|
52
|
+
client.logger.error(err);
|
|
53
|
+
});
|
package/dist/lib/esm.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './index.js';
|
|
@@ -14,21 +14,22 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./reciple/classes/builders/MessageCommandBuilder"), exports);
|
|
18
|
-
__exportStar(require("./reciple/classes/builders/MessageCommandOptionBuilder"), exports);
|
|
19
|
-
__exportStar(require("./reciple/classes/builders/SlashCommandBuilder"), exports);
|
|
20
|
-
__exportStar(require("./reciple/classes/managers/ApplicationCommandManager"), exports);
|
|
21
|
-
__exportStar(require("./reciple/classes/managers/ClientCommandManager"), exports);
|
|
22
|
-
__exportStar(require("./reciple/classes/managers/ClientModuleManager"), exports);
|
|
23
|
-
__exportStar(require("./reciple/classes/managers/CommandCooldownManager"), exports);
|
|
24
|
-
__exportStar(require("./reciple/classes/managers/MessageCommandOptionManager"), exports);
|
|
25
|
-
__exportStar(require("./reciple/classes/RecipleClient"), exports);
|
|
26
|
-
__exportStar(require("./reciple/classes/RecipleConfig"), exports);
|
|
27
|
-
__exportStar(require("./reciple/classes/RecipleModule"), exports);
|
|
28
|
-
__exportStar(require("./reciple/types/builders"), exports);
|
|
29
|
-
__exportStar(require("./reciple/types/commands"), exports);
|
|
30
|
-
__exportStar(require("./reciple/types/
|
|
17
|
+
__exportStar(require("./reciple/classes/builders/MessageCommandBuilder.js"), exports);
|
|
18
|
+
__exportStar(require("./reciple/classes/builders/MessageCommandOptionBuilder.js"), exports);
|
|
19
|
+
__exportStar(require("./reciple/classes/builders/SlashCommandBuilder.js"), exports);
|
|
20
|
+
__exportStar(require("./reciple/classes/managers/ApplicationCommandManager.js"), exports);
|
|
21
|
+
__exportStar(require("./reciple/classes/managers/ClientCommandManager.js"), exports);
|
|
22
|
+
__exportStar(require("./reciple/classes/managers/ClientModuleManager.js"), exports);
|
|
23
|
+
__exportStar(require("./reciple/classes/managers/CommandCooldownManager.js"), exports);
|
|
24
|
+
__exportStar(require("./reciple/classes/managers/MessageCommandOptionManager.js"), exports);
|
|
25
|
+
__exportStar(require("./reciple/classes/RecipleClient.js"), exports);
|
|
26
|
+
__exportStar(require("./reciple/classes/RecipleConfig.js"), exports);
|
|
27
|
+
__exportStar(require("./reciple/classes/RecipleModule.js"), exports);
|
|
28
|
+
__exportStar(require("./reciple/types/builders.js"), exports);
|
|
29
|
+
__exportStar(require("./reciple/types/commands.js"), exports);
|
|
30
|
+
__exportStar(require("./reciple/types/builders.js"), exports);
|
|
31
|
+
__exportStar(require("./reciple/types/builders.js"), exports);
|
|
31
32
|
__exportStar(require("./reciple/flags"), exports);
|
|
32
|
-
__exportStar(require("./reciple/permissions"), exports);
|
|
33
|
-
__exportStar(require("./reciple/util"), exports);
|
|
34
|
-
__exportStar(require("./reciple/version"), exports);
|
|
33
|
+
__exportStar(require("./reciple/permissions.js"), exports);
|
|
34
|
+
__exportStar(require("./reciple/util.js"), exports);
|
|
35
|
+
__exportStar(require("./reciple/version.js"), exports);
|
|
@@ -18,7 +18,7 @@ const builders_1 = require("../types/builders");
|
|
|
18
18
|
const RecipleConfig_1 = require("./RecipleConfig");
|
|
19
19
|
const fallout_utility_1 = require("fallout-utility");
|
|
20
20
|
const util_1 = require("../util");
|
|
21
|
-
const
|
|
21
|
+
const version_js_1 = require("../version.js");
|
|
22
22
|
const flags_1 = require("../flags");
|
|
23
23
|
const path_1 = __importDefault(require("path"));
|
|
24
24
|
class RecipleClient extends discord_js_1.Client {
|
|
@@ -35,7 +35,7 @@ class RecipleClient extends discord_js_1.Client {
|
|
|
35
35
|
this.modules = new ClientModuleManager_1.ClientModuleManager({
|
|
36
36
|
client: this,
|
|
37
37
|
});
|
|
38
|
-
this.version =
|
|
38
|
+
this.version = version_js_1.version;
|
|
39
39
|
this.logger = (0, util_1.createLogger)(!!options.config?.fileLogging.stringifyLoggedJSON, options.config?.fileLogging.debugmode);
|
|
40
40
|
this.config = { ...this.config, ...(options.config ?? {}) };
|
|
41
41
|
if (this.config.fileLogging.enabled)
|
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.RecipleConfig = void 0;
|
|
7
7
|
const fs_1 = require("fs");
|
|
8
|
-
const
|
|
8
|
+
const version_js_1 = require("../version.js");
|
|
9
9
|
const fallout_utility_1 = require("fallout-utility");
|
|
10
10
|
const flags_1 = require("../flags");
|
|
11
11
|
const path_1 = __importDefault(require("path"));
|
|
@@ -32,7 +32,7 @@ class RecipleConfig {
|
|
|
32
32
|
const defaultConfigPath = RecipleConfig.defaultConfigPath;
|
|
33
33
|
if (!(0, fs_1.existsSync)(defaultConfigPath))
|
|
34
34
|
throw new Error('Default Config file not found. Please reinstall Reciple.');
|
|
35
|
-
const defaultConfig = (0, fallout_utility_1.replaceAll)((0, fs_1.readFileSync)(defaultConfigPath, 'utf-8'), 'VERSION',
|
|
35
|
+
const defaultConfig = (0, fallout_utility_1.replaceAll)((0, fs_1.readFileSync)(defaultConfigPath, 'utf-8'), 'VERSION', version_js_1.version);
|
|
36
36
|
(0, fs_1.writeFileSync)(this.configPath, defaultConfig, 'utf-8');
|
|
37
37
|
if (!(0, fs_1.existsSync)(this.configPath))
|
|
38
38
|
throw new Error('Failed to create config file.');
|
|
@@ -48,7 +48,7 @@ class RecipleConfig {
|
|
|
48
48
|
const config = (0, fs_1.readFileSync)(this.configPath, 'utf-8');
|
|
49
49
|
this.config = yaml_1.default.parse(config);
|
|
50
50
|
if (!this._isSupportedConfig())
|
|
51
|
-
throw new Error('Unsupported config version. Your config version: ' + (this.config?.version || 'No version specified.') + ', Reciple version: ' +
|
|
51
|
+
throw new Error('Unsupported config version. Your config version: ' + (this.config?.version || 'No version specified.') + ', Reciple version: ' + version_js_1.version);
|
|
52
52
|
return this;
|
|
53
53
|
}
|
|
54
54
|
/**
|
|
@@ -78,7 +78,7 @@ class RecipleConfig {
|
|
|
78
78
|
* Check if the config version is supported
|
|
79
79
|
*/
|
|
80
80
|
_isSupportedConfig() {
|
|
81
|
-
return (0,
|
|
81
|
+
return (0, version_js_1.isSupportedVersion)(this.config?.version || '0.0.0', version_js_1.version);
|
|
82
82
|
}
|
|
83
83
|
/**
|
|
84
84
|
* Ask for a token
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,27 +1,4 @@
|
|
|
1
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
4
|
};
|
|
@@ -113,7 +90,7 @@ class ClientModuleManager {
|
|
|
113
90
|
const modules = [];
|
|
114
91
|
for (const file of options.files) {
|
|
115
92
|
try {
|
|
116
|
-
const resolveFile = await
|
|
93
|
+
const resolveFile = await import(file);
|
|
117
94
|
let script = resolveFile?.default ?? resolveFile;
|
|
118
95
|
if (script instanceof RecipleModule_1.RecipleModule) {
|
|
119
96
|
modules.push(script);
|
|
@@ -150,18 +127,18 @@ class ClientModuleManager {
|
|
|
150
127
|
return false;
|
|
151
128
|
return true;
|
|
152
129
|
}
|
|
153
|
-
async
|
|
130
|
+
async getModulePaths(options) {
|
|
154
131
|
const modules = [];
|
|
155
|
-
for (const dir of
|
|
132
|
+
for (const dir of options?.folders ?? (0, discord_js_1.normalizeArray)([this.client.config.modulesFolder])) {
|
|
156
133
|
if (!(0, fs_1.existsSync)(dir))
|
|
157
134
|
(0, fs_1.mkdirSync)(dir, { recursive: true });
|
|
158
135
|
if (!(0, fs_1.lstatSync)(dir).isDirectory())
|
|
159
136
|
continue;
|
|
160
137
|
modules.push(...(0, fs_1.readdirSync)(dir)
|
|
161
138
|
.map(file => path_1.default.join(flags_1.cwd, dir, file))
|
|
162
|
-
.filter(file =>
|
|
139
|
+
.filter(file => (options?.filter ? options.filter(file) : file.endsWith('.js'))));
|
|
163
140
|
}
|
|
164
|
-
return modules.filter(file => !this.client.config.ignoredFiles.some(ignored => (0, wildcard_match_1.default)(ignored)(path_1.default.basename(file))));
|
|
141
|
+
return modules.filter(file => !(options?.ignoredFiles ?? this.client.config.ignoredFiles).some(ignored => (0, wildcard_match_1.default)(ignored)(path_1.default.basename(file))));
|
|
165
142
|
}
|
|
166
143
|
}
|
|
167
144
|
exports.ClientModuleManager = ClientModuleManager;
|
|
File without changes
|
|
File without changes
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.cwd = exports.token = exports.flags = exports.commander = void 0;
|
|
4
|
-
const
|
|
4
|
+
const version_js_1 = require("./version.js");
|
|
5
5
|
const commander_1 = require("commander");
|
|
6
6
|
/**
|
|
7
7
|
* Commander
|
|
@@ -9,7 +9,7 @@ const commander_1 = require("commander");
|
|
|
9
9
|
exports.commander = new commander_1.Command()
|
|
10
10
|
.name('reciple')
|
|
11
11
|
.description('Reciple.js - Discord.js handler cli')
|
|
12
|
-
.version(`v${
|
|
12
|
+
.version(`v${version_js_1.rawVersion}`, '-v, --version')
|
|
13
13
|
.argument('[current-working-directory]', 'Change the current working directory')
|
|
14
14
|
.option('-t, --token <token>', 'Replace used bot token')
|
|
15
15
|
.option('-c, --config <config>', 'Change path to config file')
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -5,7 +5,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.isSupportedVersion = exports.parseVersion = exports.isValidVersion = exports.rawVersion = exports.version = void 0;
|
|
7
7
|
const semver_1 = __importDefault(require("semver"));
|
|
8
|
-
// TODO: ESM support
|
|
9
8
|
/**
|
|
10
9
|
* Current reciple version
|
|
11
10
|
*/
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './index.js';
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
export * from './reciple/classes/builders/MessageCommandBuilder';
|
|
2
|
-
export * from './reciple/classes/builders/MessageCommandOptionBuilder';
|
|
3
|
-
export * from './reciple/classes/builders/SlashCommandBuilder';
|
|
4
|
-
export * from './reciple/classes/managers/ApplicationCommandManager';
|
|
5
|
-
export * from './reciple/classes/managers/ClientCommandManager';
|
|
6
|
-
export * from './reciple/classes/managers/ClientModuleManager';
|
|
7
|
-
export * from './reciple/classes/managers/CommandCooldownManager';
|
|
8
|
-
export * from './reciple/classes/managers/MessageCommandOptionManager';
|
|
9
|
-
export * from './reciple/classes/RecipleClient';
|
|
10
|
-
export * from './reciple/classes/RecipleConfig';
|
|
11
|
-
export * from './reciple/classes/RecipleModule';
|
|
12
|
-
export * from './reciple/types/builders';
|
|
13
|
-
export * from './reciple/types/commands';
|
|
14
|
-
export * from './reciple/types/
|
|
1
|
+
export * from './reciple/classes/builders/MessageCommandBuilder.js';
|
|
2
|
+
export * from './reciple/classes/builders/MessageCommandOptionBuilder.js';
|
|
3
|
+
export * from './reciple/classes/builders/SlashCommandBuilder.js';
|
|
4
|
+
export * from './reciple/classes/managers/ApplicationCommandManager.js';
|
|
5
|
+
export * from './reciple/classes/managers/ClientCommandManager.js';
|
|
6
|
+
export * from './reciple/classes/managers/ClientModuleManager.js';
|
|
7
|
+
export * from './reciple/classes/managers/CommandCooldownManager.js';
|
|
8
|
+
export * from './reciple/classes/managers/MessageCommandOptionManager.js';
|
|
9
|
+
export * from './reciple/classes/RecipleClient.js';
|
|
10
|
+
export * from './reciple/classes/RecipleConfig.js';
|
|
11
|
+
export * from './reciple/classes/RecipleModule.js';
|
|
12
|
+
export * from './reciple/types/builders.js';
|
|
13
|
+
export * from './reciple/types/commands.js';
|
|
14
|
+
export * from './reciple/types/builders.js';
|
|
15
|
+
export * from './reciple/types/builders.js';
|
|
15
16
|
export * from './reciple/flags';
|
|
16
|
-
export * from './reciple/permissions';
|
|
17
|
-
export * from './reciple/util';
|
|
18
|
-
export * from './reciple/version';
|
|
17
|
+
export * from './reciple/permissions.js';
|
|
18
|
+
export * from './reciple/util.js';
|
|
19
|
+
export * from './reciple/version.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Collection
|
|
2
|
-
import { ClientModuleManagerGetModulesFromFilesOptions } from '../../types/paramOptions';
|
|
1
|
+
import { Collection } from 'discord.js';
|
|
2
|
+
import { ClientModuleManagerGetModulePathsOptions, ClientModuleManagerGetModulesFromFilesOptions } from '../../types/paramOptions';
|
|
3
3
|
import { RecipleClient } from '../RecipleClient';
|
|
4
4
|
import { RecipleModule, RecipleScript } from '../RecipleModule';
|
|
5
5
|
export interface ClientModuleManagerOptions {
|
|
@@ -15,5 +15,5 @@ export declare class ClientModuleManager {
|
|
|
15
15
|
unLoadModules(modules: RecipleModule[], removeUnloadedModules?: boolean, ignoreErrors?: boolean): Promise<RecipleModule[]>;
|
|
16
16
|
getModulesFromFiles(options: ClientModuleManagerGetModulesFromFilesOptions): Promise<RecipleModule[]>;
|
|
17
17
|
static validateScript(script: unknown): script is RecipleScript;
|
|
18
|
-
|
|
18
|
+
getModulePaths(options?: ClientModuleManagerGetModulePathsOptions): Promise<string[]>;
|
|
19
19
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ConfigCommandPermissions } from '../classes/RecipleConfig';
|
|
2
|
-
import { PermissionsBitField } from 'discord.js';
|
|
2
|
+
import { Awaitable, PermissionsBitField } from 'discord.js';
|
|
3
3
|
import { AnyCommandBuilder } from './builders';
|
|
4
4
|
export interface UserHasCommandPermissionsOptions {
|
|
5
5
|
/**
|
|
@@ -23,3 +23,8 @@ export interface ClientModuleManagerGetModulesFromFilesOptions {
|
|
|
23
23
|
disabeVersionCheck?: boolean;
|
|
24
24
|
dontSkipError?: boolean;
|
|
25
25
|
}
|
|
26
|
+
export interface ClientModuleManagerGetModulePathsOptions {
|
|
27
|
+
folders?: string[];
|
|
28
|
+
ignoredFiles?: string[];
|
|
29
|
+
filter?: (file: string) => Awaitable<boolean>;
|
|
30
|
+
}
|
package/package.json
CHANGED
|
@@ -1,18 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "reciple",
|
|
3
|
-
"version": "6.0.0-dev.
|
|
4
|
-
"bin": "./dist/
|
|
3
|
+
"version": "6.0.0-dev.13",
|
|
4
|
+
"bin": "./dist/lib/bin.mjs",
|
|
5
5
|
"license": "GPL-3.0",
|
|
6
|
-
"
|
|
6
|
+
"type": "commonjs",
|
|
7
|
+
"main": "./dist/lib/index.js",
|
|
7
8
|
"types": "./dist/types/index.d.ts",
|
|
8
|
-
"module": "./
|
|
9
|
+
"module": "./esm.mjs",
|
|
9
10
|
"author": "FalloutStudios",
|
|
10
11
|
"description": "Handler for Discord.js",
|
|
11
12
|
"homepage": "https://reciple.js.org",
|
|
12
13
|
"exports": {
|
|
13
|
-
"
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
".": {
|
|
15
|
+
"import": {
|
|
16
|
+
"types": "./dist/types/index.d.ts",
|
|
17
|
+
"default": "./dist/lib/esm.mjs"
|
|
18
|
+
},
|
|
19
|
+
"require": {
|
|
20
|
+
"types": "./dist/types/index.d.ts",
|
|
21
|
+
"default": "./dist/lib/index.js"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
16
24
|
},
|
|
17
25
|
"keywords": [
|
|
18
26
|
"Discord",
|
|
@@ -29,12 +37,11 @@
|
|
|
29
37
|
"format": "npx prettier --write src",
|
|
30
38
|
"clean": "npx rimraf dist",
|
|
31
39
|
"build": "npm run clean && npx tsc",
|
|
32
|
-
"build:publish": "npm run format && npm run build &&
|
|
40
|
+
"build:publish": "npm run format && npm run build && npm run docs && npm publish",
|
|
33
41
|
"build:publish-dev": "npm run format && npm run build && npm publish --tag dev",
|
|
34
|
-
"test": "npm run build && npm run start -w test",
|
|
42
|
+
"test": "npm run build && npm install && npm run start -w test",
|
|
35
43
|
"docs": "npx docgen --typescript true -c ./docs/index.json -o ./docs/docs.json -i src/index.ts",
|
|
36
|
-
"watch": "npx tsc --watch --noEmit"
|
|
37
|
-
"husky:install": "npx husky install"
|
|
44
|
+
"watch": "npx tsc --watch --noEmit"
|
|
38
45
|
},
|
|
39
46
|
"repository": {
|
|
40
47
|
"type": "git",
|
|
@@ -54,7 +61,7 @@
|
|
|
54
61
|
"chalk": "4.1.2",
|
|
55
62
|
"commander": "^9.4.1",
|
|
56
63
|
"dotenv": "^16.0.3",
|
|
57
|
-
"fallout-utility": "^1.5.
|
|
64
|
+
"fallout-utility": "^1.5.13",
|
|
58
65
|
"semver": "^7.3.7",
|
|
59
66
|
"wildcard-match": "^5.1.2",
|
|
60
67
|
"yaml": "^2.1.1"
|
|
@@ -64,7 +71,6 @@
|
|
|
64
71
|
"@types/node": "^18.11.0",
|
|
65
72
|
"@types/semver": "^7.3.12",
|
|
66
73
|
"discord.js": "^14.6.0",
|
|
67
|
-
"husky": "^8.0.1",
|
|
68
74
|
"prettier": "2.7.1",
|
|
69
75
|
"rimraf": "^3.0.2",
|
|
70
76
|
"typescript": "^4.8.4"
|
package/dist/cjs/bin.js
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
-
};
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
const RecipleClient_1 = require("./reciple/classes/RecipleClient");
|
|
8
|
-
const RecipleConfig_1 = require("./reciple/classes/RecipleConfig");
|
|
9
|
-
const version_1 = require("./reciple/version");
|
|
10
|
-
const fs_1 = require("fs");
|
|
11
|
-
const flags_1 = require("./reciple/flags");
|
|
12
|
-
const fallout_utility_1 = require("fallout-utility");
|
|
13
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
14
|
-
require("dotenv/config");
|
|
15
|
-
const path_1 = __importDefault(require("path"));
|
|
16
|
-
const allowedFiles = ['node_modules', 'reciple.yml', 'package.json'];
|
|
17
|
-
const configPath = path_1.default.join(flags_1.cwd, './reciple.yml');
|
|
18
|
-
if ((0, fs_1.readdirSync)(flags_1.cwd).filter(f => !f.startsWith('.') && allowedFiles.indexOf(f)).length > 0 && !(0, fs_1.existsSync)(flags_1.flags.config ?? configPath)) {
|
|
19
|
-
const ask = (flags_1.flags.yes ? 'y' : null) ?? (0, fallout_utility_1.input)('This directory does not contain reciple.yml. Would you like to init axis here? [y/n] ') ?? '';
|
|
20
|
-
if (ask.toString().toLowerCase() !== 'y')
|
|
21
|
-
process.exit(0);
|
|
22
|
-
}
|
|
23
|
-
let configParser;
|
|
24
|
-
try {
|
|
25
|
-
configParser = new RecipleConfig_1.RecipleConfig(flags_1.flags.config ?? configPath).parseConfig();
|
|
26
|
-
}
|
|
27
|
-
catch (err) {
|
|
28
|
-
console.error(`${chalk_1.default.bold.red('Config Error')}: ${chalk_1.default.white(err.message)}`);
|
|
29
|
-
process.exit(1);
|
|
30
|
-
}
|
|
31
|
-
const config = configParser.getConfig();
|
|
32
|
-
const client = new RecipleClient_1.RecipleClient({ config: config, ...config.client });
|
|
33
|
-
if (!client.isClientLogsSilent)
|
|
34
|
-
client.logger.info('Starting Reciple client v' + version_1.rawVersion);
|
|
35
|
-
(async () => {
|
|
36
|
-
client.addCommandListeners();
|
|
37
|
-
await client.modules.startModules(await client.modules.getModulesFromFiles({
|
|
38
|
-
files: await client.modules.getModuleFiles(),
|
|
39
|
-
}));
|
|
40
|
-
client.on('ready', async () => {
|
|
41
|
-
await client.modules.loadModules(client.modules.modules.toJSON(), true);
|
|
42
|
-
if (!client.isClientLogsSilent)
|
|
43
|
-
client.logger.log(`Loaded ${client.commands.slashCommands.size} slash commands`, `Loaded ${client.commands.messageCommands.size} message commands`);
|
|
44
|
-
if (client.config.commands.slashCommand.registerCommands)
|
|
45
|
-
await client.commands.registerApplicationCommands();
|
|
46
|
-
if (!client.isClientLogsSilent)
|
|
47
|
-
client.logger.warn(`Logged in as ${client.user?.tag || 'Unknown'}!`);
|
|
48
|
-
client.on('cacheSweep', () => client.cooldowns.clean());
|
|
49
|
-
});
|
|
50
|
-
client.login(config.token).catch(err => {
|
|
51
|
-
if (!client.isClientLogsSilent)
|
|
52
|
-
client.logger.error(err);
|
|
53
|
-
});
|
|
54
|
-
})();
|