reciple 5.0.0-pre.6 → 5.1.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/bin/bin.js +1 -1
- package/bin/reciple/classes/CommandCooldownManager.d.ts +4 -3
- package/bin/reciple/classes/CommandCooldownManager.js +5 -1
- package/bin/reciple/classes/MessageCommandOptionManager.d.ts +2 -4
- package/bin/reciple/classes/MessageCommandOptionManager.js +3 -5
- package/bin/reciple/classes/RecipleClient.d.ts +5 -5
- package/bin/reciple/classes/RecipleClient.js +3 -3
- package/bin/reciple/classes/builders/MessageCommandBuilder.d.ts +5 -7
- package/bin/reciple/classes/builders/MessageCommandBuilder.js +1 -1
- package/bin/reciple/classes/builders/SlashCommandBuilder.d.ts +6 -8
- package/bin/reciple/classes/builders/SlashCommandBuilder.js +1 -1
- package/bin/reciple/flags.d.ts +1 -1
- package/bin/reciple/flags.js +3 -7
- package/bin/reciple/logger.js +4 -4
- package/bin/reciple/modules.d.ts +2 -2
- package/bin/reciple/modules.js +3 -2
- package/bin/reciple/registerApplicationCommands.js +2 -1
- package/bin/reciple/types/builders.d.ts +6 -10
- package/bin/reciple/types/builders.js +1 -1
- package/bin/reciple/types/commands.d.ts +22 -11
- package/bin/reciple/types/paramOptions.d.ts +1 -1
- package/package.json +7 -6
- package/resource/reciple.yml +17 -15
package/bin/bin.js
CHANGED
|
@@ -42,7 +42,7 @@ catch (err) {
|
|
|
42
42
|
const config = configParser.getConfig();
|
|
43
43
|
const client = new RecipleClient_1.RecipleClient(Object.assign({ config: config }, config.client));
|
|
44
44
|
if (config.fileLogging.clientLogs)
|
|
45
|
-
client.logger.info('Reciple
|
|
45
|
+
client.logger.info('Starting Reciple client v' + version_1.rawVersion);
|
|
46
46
|
(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
47
47
|
yield client.startModules((0, discord_js_1.normalizeArray)(config.modulesFolder));
|
|
48
48
|
client.on('ready', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Guild, TextBasedChannel, User } from 'discord.js';
|
|
1
|
+
import { Guild, RestOrArray, TextBasedChannel, User } from 'discord.js';
|
|
2
2
|
import { CommandBuilderType } from '../types/builders';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* cooled-down user object interface
|
|
5
5
|
*/
|
|
6
6
|
export interface CooledDownUser {
|
|
7
7
|
user: User;
|
|
@@ -12,9 +12,10 @@ export interface CooledDownUser {
|
|
|
12
12
|
expireTime: number;
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
15
|
+
* cooled-down users manager
|
|
16
16
|
*/
|
|
17
17
|
export declare class CommandCooldownManager extends Array<CooledDownUser> {
|
|
18
|
+
constructor(...data: RestOrArray<CooledDownUser>);
|
|
18
19
|
/**
|
|
19
20
|
* Alias for `CommandCooldownManager#push()`
|
|
20
21
|
* @param options Cooled-down user data
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CommandCooldownManager = void 0;
|
|
4
|
+
const discord_js_1 = require("discord.js");
|
|
4
5
|
/**
|
|
5
|
-
*
|
|
6
|
+
* cooled-down users manager
|
|
6
7
|
*/
|
|
7
8
|
class CommandCooldownManager extends Array {
|
|
9
|
+
constructor(...data) {
|
|
10
|
+
super(...(0, discord_js_1.normalizeArray)(data));
|
|
11
|
+
}
|
|
8
12
|
/**
|
|
9
13
|
* Alias for `CommandCooldownManager#push()`
|
|
10
14
|
* @param options Cooled-down user data
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { MessageCommandValidatedOption } from './builders/MessageCommandBuilder';
|
|
2
|
+
import { RestOrArray } from 'discord.js';
|
|
2
3
|
/**
|
|
3
4
|
* Validated message options manager
|
|
4
5
|
*/
|
|
5
6
|
export declare class MessageCommandOptionManager extends Array<MessageCommandValidatedOption> {
|
|
6
|
-
|
|
7
|
-
* @param options Validated options
|
|
8
|
-
*/
|
|
9
|
-
constructor(...options: MessageCommandValidatedOption[]);
|
|
7
|
+
constructor(...data: RestOrArray<MessageCommandValidatedOption>);
|
|
10
8
|
/**
|
|
11
9
|
* Get the option info
|
|
12
10
|
* @param name Option name
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MessageCommandOptionManager = void 0;
|
|
4
|
+
const discord_js_1 = require("discord.js");
|
|
4
5
|
/**
|
|
5
6
|
* Validated message options manager
|
|
6
7
|
*/
|
|
7
8
|
class MessageCommandOptionManager extends Array {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
*/
|
|
11
|
-
constructor(...options) {
|
|
12
|
-
super(...(options !== null && options !== void 0 ? options : []));
|
|
9
|
+
constructor(...data) {
|
|
10
|
+
super(...(0, discord_js_1.normalizeArray)(data));
|
|
13
11
|
}
|
|
14
12
|
get(name, required) {
|
|
15
13
|
const option = this.find(o => o.name == name);
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { MessageCommandBuilder, MessageCommandExecuteData } from './builders/MessageCommandBuilder';
|
|
2
2
|
import { SlashCommandBuilder, SlashCommandExecuteData } from './builders/SlashCommandBuilder';
|
|
3
3
|
import { ApplicationCommandBuilder } from '../registerApplicationCommands';
|
|
4
|
-
import {
|
|
4
|
+
import { AnyCommandExecuteData, AnyCommandHaltData } from '../types/commands';
|
|
5
5
|
import { CommandCooldownManager } from './CommandCooldownManager';
|
|
6
|
-
import {
|
|
6
|
+
import { AnyCommandBuilder, CommandBuilderType } from '../types/builders';
|
|
7
7
|
import { RecipleClientAddModuleOptions } from '../types/paramOptions';
|
|
8
8
|
import { Logger as ILogger } from 'fallout-utility';
|
|
9
9
|
import { Config } from './RecipleConfig';
|
|
10
10
|
import { RecipleModule } from '../modules';
|
|
11
11
|
import { ApplicationCommandData, Awaitable, ChatInputCommandInteraction, Client, ClientEvents, ClientOptions, Interaction, Message, RestOrArray } from 'discord.js';
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* Options for Reciple client
|
|
14
14
|
*/
|
|
15
15
|
export interface RecipleClientOptions extends ClientOptions {
|
|
16
16
|
config?: Config;
|
|
17
17
|
}
|
|
18
18
|
/**
|
|
19
|
-
* Reciple client commands
|
|
19
|
+
* Reciple client commands
|
|
20
20
|
*/
|
|
21
21
|
export interface RecipleClientCommands {
|
|
22
22
|
slashCommands: {
|
|
@@ -35,7 +35,7 @@ export interface RecipleClientEvents extends ClientEvents {
|
|
|
35
35
|
recipleReplyError: [error: unknown];
|
|
36
36
|
}
|
|
37
37
|
/**
|
|
38
|
-
*
|
|
38
|
+
* Reciple client
|
|
39
39
|
*/
|
|
40
40
|
export interface RecipleClient<Ready extends boolean = boolean> extends Client<Ready> {
|
|
41
41
|
on<E extends keyof RecipleClientEvents>(event: E, listener: (...args: RecipleClientEvents[E]) => Awaitable<void>): this;
|
|
@@ -16,11 +16,11 @@ exports.RecipleClient = void 0;
|
|
|
16
16
|
const MessageCommandBuilder_1 = require("./builders/MessageCommandBuilder");
|
|
17
17
|
const SlashCommandBuilder_1 = require("./builders/SlashCommandBuilder");
|
|
18
18
|
const registerApplicationCommands_1 = require("../registerApplicationCommands");
|
|
19
|
-
const
|
|
19
|
+
const commands_1 = require("../types/commands");
|
|
20
20
|
const permissions_1 = require("../permissions");
|
|
21
21
|
const CommandCooldownManager_1 = require("./CommandCooldownManager");
|
|
22
22
|
const MessageCommandOptionManager_1 = require("./MessageCommandOptionManager");
|
|
23
|
-
const
|
|
23
|
+
const builders_1 = require("../types/builders");
|
|
24
24
|
const fallout_utility_1 = require("fallout-utility");
|
|
25
25
|
const RecipleConfig_1 = require("./RecipleConfig");
|
|
26
26
|
const modules_1 = require("../modules");
|
|
@@ -47,7 +47,7 @@ class RecipleClient extends discord_js_1.Client {
|
|
|
47
47
|
throw new Error('Config is not defined.');
|
|
48
48
|
this.config = Object.assign(Object.assign({}, this.config), ((_c = options.config) !== null && _c !== void 0 ? _c : {}));
|
|
49
49
|
if (this.config.fileLogging.enabled)
|
|
50
|
-
this.logger.logFile((_d = this.config.fileLogging.logFilePath) !== null && _d !== void 0 ? _d :
|
|
50
|
+
this.logger.logFile(path_1.default.join(flags_1.cwd, (_d = this.config.fileLogging.logFilePath) !== null && _d !== void 0 ? _d : 'logs/latest.log'), false);
|
|
51
51
|
}
|
|
52
52
|
/**
|
|
53
53
|
* Load modules from modules folder
|
|
@@ -1,19 +1,17 @@
|
|
|
1
|
-
import { CommandBuilderType,
|
|
1
|
+
import { CommandBuilderType, CommandHaltFunction, CommandExecuteFunction, SharedCommandBuilderProperties } from '../../types/builders';
|
|
2
|
+
import { AnyCommandExecuteData, BaseCommandExecuteData, CommandHaltData } from '../../types/commands';
|
|
3
|
+
import { Message, PermissionResolvable, RestOrArray } from 'discord.js';
|
|
2
4
|
import { MessageCommandOptionManager } from '../MessageCommandOptionManager';
|
|
3
5
|
import { MessageCommandOptionBuilder } from './MessageCommandOptionBuilder';
|
|
4
6
|
import { Command as CommandMessage } from 'fallout-utility';
|
|
5
|
-
import { Message, PermissionResolvable, RestOrArray } from 'discord.js';
|
|
6
|
-
import { CommandHaltData } from '../../types/commands';
|
|
7
|
-
import { RecipleClient } from '../RecipleClient';
|
|
8
7
|
/**
|
|
9
8
|
* Execute data for message command
|
|
10
9
|
*/
|
|
11
|
-
export interface MessageCommandExecuteData {
|
|
10
|
+
export interface MessageCommandExecuteData extends BaseCommandExecuteData {
|
|
12
11
|
message: Message;
|
|
13
12
|
options: MessageCommandOptionManager;
|
|
14
13
|
command: CommandMessage;
|
|
15
14
|
builder: MessageCommandBuilder;
|
|
16
|
-
client: RecipleClient<true>;
|
|
17
15
|
}
|
|
18
16
|
/**
|
|
19
17
|
* Validated message command option
|
|
@@ -26,7 +24,7 @@ export interface MessageCommandValidatedOption {
|
|
|
26
24
|
missing: boolean;
|
|
27
25
|
}
|
|
28
26
|
/**
|
|
29
|
-
*
|
|
27
|
+
* Halt data for message command
|
|
30
28
|
*/
|
|
31
29
|
export declare type MessageCommandHaltData = CommandHaltData<CommandBuilderType.MessageCommand>;
|
|
32
30
|
/**
|
|
@@ -11,9 +11,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.validateMessageCommandOptions = exports.MessageCommandBuilder = void 0;
|
|
13
13
|
const builders_1 = require("../../types/builders");
|
|
14
|
+
const discord_js_1 = require("discord.js");
|
|
14
15
|
const MessageCommandOptionManager_1 = require("../MessageCommandOptionManager");
|
|
15
16
|
const MessageCommandOptionBuilder_1 = require("./MessageCommandOptionBuilder");
|
|
16
|
-
const discord_js_1 = require("discord.js");
|
|
17
17
|
/**
|
|
18
18
|
* Reciple builder for message command
|
|
19
19
|
*/
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import { CommandBuilderType,
|
|
2
|
-
import { CommandHaltData } from '../../types/commands';
|
|
3
|
-
import { RecipleClient } from '../RecipleClient';
|
|
1
|
+
import { CommandBuilderType, CommandHaltFunction, CommandExecuteFunction, SharedCommandBuilderProperties } from '../../types/builders';
|
|
2
|
+
import { AnyCommandExecuteData, BaseCommandExecuteData, CommandHaltData } from '../../types/commands';
|
|
4
3
|
import { ChatInputCommandInteraction, PermissionResolvable, RestOrArray, SlashCommandBuilder as DiscordJsSlashCommandBuilder, SlashCommandSubcommandBuilder, SlashCommandSubcommandGroupBuilder, SlashCommandSubcommandsOnlyBuilder as DiscordJsSlashCommandSubcommandsOnlyBuilder } from 'discord.js';
|
|
5
4
|
/**
|
|
6
|
-
* Execute data for
|
|
5
|
+
* Execute data for slash command
|
|
7
6
|
*/
|
|
8
|
-
export interface SlashCommandExecuteData {
|
|
7
|
+
export interface SlashCommandExecuteData extends BaseCommandExecuteData {
|
|
9
8
|
interaction: ChatInputCommandInteraction;
|
|
10
9
|
builder: SlashCommandBuilder;
|
|
11
|
-
client: RecipleClient<true>;
|
|
12
10
|
}
|
|
13
11
|
/**
|
|
14
12
|
* Slash command halt data
|
|
@@ -29,9 +27,9 @@ export interface SlashCommandBuilder extends DiscordJsSlashCommandBuilder {
|
|
|
29
27
|
addSubcommand(input: SlashCommandSubcommandBuilder | ((subcommandGroup: SlashCommandSubcommandBuilder) => SlashCommandSubcommandBuilder)): SlashCommandSubcommandsOnlyBuilder;
|
|
30
28
|
}
|
|
31
29
|
/**
|
|
32
|
-
* Reciple builder for
|
|
30
|
+
* Reciple builder for slash command
|
|
33
31
|
*/
|
|
34
|
-
export declare class SlashCommandBuilder extends DiscordJsSlashCommandBuilder implements SharedCommandBuilderProperties {
|
|
32
|
+
export declare class SlashCommandBuilder extends DiscordJsSlashCommandBuilder implements SharedCommandBuilderProperties, SlashCommandBuilder {
|
|
35
33
|
readonly type = CommandBuilderType.SlashCommand;
|
|
36
34
|
cooldown: number;
|
|
37
35
|
requiredBotPermissions: PermissionResolvable[];
|
|
@@ -4,7 +4,7 @@ exports.SlashCommandBuilder = void 0;
|
|
|
4
4
|
const builders_1 = require("../../types/builders");
|
|
5
5
|
const discord_js_1 = require("discord.js");
|
|
6
6
|
/**
|
|
7
|
-
* Reciple builder for
|
|
7
|
+
* Reciple builder for slash command
|
|
8
8
|
*/
|
|
9
9
|
class SlashCommandBuilder extends discord_js_1.SlashCommandBuilder {
|
|
10
10
|
constructor() {
|
package/bin/reciple/flags.d.ts
CHANGED
package/bin/reciple/flags.js
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.cwd = exports.token = exports.flags = exports.commander = void 0;
|
|
7
4
|
const version_1 = require("./version");
|
|
8
5
|
const commander_1 = require("commander");
|
|
9
|
-
const path_1 = __importDefault(require("path"));
|
|
10
6
|
/**
|
|
11
7
|
* Commander
|
|
12
8
|
*/
|
|
@@ -17,7 +13,7 @@ exports.commander = new commander_1.Command()
|
|
|
17
13
|
.argument('[current-working-directory]', 'Change the current working directory')
|
|
18
14
|
.option('-t, --token <token>', 'Replace used bot token')
|
|
19
15
|
.option('-c, --config <config>', 'Change path to config file')
|
|
20
|
-
.option('-D, --debugmode', '
|
|
16
|
+
.option('-D, --debugmode', 'Enable debug mode')
|
|
21
17
|
.option('-y, --yes', 'Automatically agree to Reciple confirmation prompts')
|
|
22
18
|
.option('-v, --version', 'Display version')
|
|
23
19
|
.parse();
|
|
@@ -26,10 +22,10 @@ exports.commander = new commander_1.Command()
|
|
|
26
22
|
*/
|
|
27
23
|
exports.flags = exports.commander.opts();
|
|
28
24
|
/**
|
|
29
|
-
*
|
|
25
|
+
* Token flag
|
|
30
26
|
*/
|
|
31
27
|
exports.token = exports.flags.token;
|
|
32
28
|
/**
|
|
33
29
|
* Current working directory
|
|
34
30
|
*/
|
|
35
|
-
exports.cwd =
|
|
31
|
+
exports.cwd = exports.commander.args[0] || process.cwd();
|
package/bin/reciple/logger.js
CHANGED
|
@@ -20,10 +20,10 @@ function createLogger(stringifyJSON, debugmode = false, colorizeMessage = true)
|
|
|
20
20
|
enableDebugMode: (_a = flags_1.flags.debugmode) !== null && _a !== void 0 ? _a : debugmode,
|
|
21
21
|
loggerName: 'Main',
|
|
22
22
|
prefixes: {
|
|
23
|
-
[fallout_utility_1.LogLevels.INFO]: (name) => `[${
|
|
24
|
-
[fallout_utility_1.LogLevels.WARN]: (name) => `[${chalk_1.default.
|
|
25
|
-
[fallout_utility_1.LogLevels.ERROR]: (name) => `[${chalk_1.default.
|
|
26
|
-
[fallout_utility_1.LogLevels.DEBUG]: (name) => `[${chalk_1.default.
|
|
23
|
+
[fallout_utility_1.LogLevels.INFO]: (name) => `[${new Date().toLocaleTimeString()}][${(name ? name + "/" : '') + "INFO"}]`,
|
|
24
|
+
[fallout_utility_1.LogLevels.WARN]: (name) => `[${chalk_1.default.yellow(new Date().toLocaleTimeString())}][${chalk_1.default.yellow((name ? name + "/" : '') + "WARN")}]`,
|
|
25
|
+
[fallout_utility_1.LogLevels.ERROR]: (name) => `[${chalk_1.default.red(new Date().toLocaleTimeString())}][${chalk_1.default.red((name ? name + "/" : '') + "ERROR")}]`,
|
|
26
|
+
[fallout_utility_1.LogLevels.DEBUG]: (name) => `[${chalk_1.default.blue(new Date().toLocaleTimeString())}][${chalk_1.default.blue((name ? name + "/" : '') + "DEBUG")}]`
|
|
27
27
|
},
|
|
28
28
|
colorMessages: {
|
|
29
29
|
[fallout_utility_1.LogLevels.INFO]: (message) => message,
|
package/bin/reciple/modules.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export declare type LoadedModules = {
|
|
|
5
5
|
modules: RecipleModule[];
|
|
6
6
|
};
|
|
7
7
|
/**
|
|
8
|
-
* Reciple script object
|
|
8
|
+
* Reciple script object
|
|
9
9
|
*/
|
|
10
10
|
export interface RecipleScript {
|
|
11
11
|
versions: string | string[];
|
|
@@ -14,7 +14,7 @@ export interface RecipleScript {
|
|
|
14
14
|
onStart(reciple: RecipleClient): boolean | Promise<boolean>;
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
|
-
* Reciple module object
|
|
17
|
+
* Reciple module object
|
|
18
18
|
*/
|
|
19
19
|
export interface RecipleModule {
|
|
20
20
|
script: RecipleScript;
|
package/bin/reciple/modules.js
CHANGED
|
@@ -14,11 +14,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.getModules = void 0;
|
|
16
16
|
const builders_1 = require("./types/builders");
|
|
17
|
+
const discord_js_1 = require("discord.js");
|
|
17
18
|
const version_1 = require("./version");
|
|
18
19
|
const fs_1 = require("fs");
|
|
19
20
|
const wildcard_match_1 = __importDefault(require("wildcard-match"));
|
|
21
|
+
const flags_1 = require("./flags");
|
|
20
22
|
const path_1 = __importDefault(require("path"));
|
|
21
|
-
const discord_js_1 = require("discord.js");
|
|
22
23
|
/**
|
|
23
24
|
* Load modules from folder
|
|
24
25
|
* @param client Reciple client
|
|
@@ -28,7 +29,7 @@ function getModules(client, folder) {
|
|
|
28
29
|
var _a;
|
|
29
30
|
return __awaiter(this, void 0, void 0, function* () {
|
|
30
31
|
const response = { commands: [], modules: [] };
|
|
31
|
-
const modulesDir = folder || 'modules';
|
|
32
|
+
const modulesDir = folder || path_1.default.join(flags_1.cwd, 'modules');
|
|
32
33
|
if (!(0, fs_1.existsSync)(modulesDir))
|
|
33
34
|
(0, fs_1.mkdirSync)(modulesDir, { recursive: true });
|
|
34
35
|
const ignoredFiles = (client.config.ignoredFiles || []).map(file => file.endsWith('.js') ? file : `${file}.js`);
|
|
@@ -10,6 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.registerApplicationCommands = void 0;
|
|
13
|
+
const discord_js_1 = require("discord.js");
|
|
13
14
|
const SlashCommandBuilder_1 = require("./classes/builders/SlashCommandBuilder");
|
|
14
15
|
/**
|
|
15
16
|
* Register application commands
|
|
@@ -19,7 +20,7 @@ function registerApplicationCommands(options) {
|
|
|
19
20
|
var _a, _b, _c, _d;
|
|
20
21
|
return __awaiter(this, void 0, void 0, function* () {
|
|
21
22
|
const client = options.client;
|
|
22
|
-
const guilds =
|
|
23
|
+
const guilds = (0, discord_js_1.normalizeArray)(options.guilds);
|
|
23
24
|
const commands = (_b = Object.values((_a = options.commands) !== null && _a !== void 0 ? _a : client.commands.slashCommands).map(cmd => {
|
|
24
25
|
var _a;
|
|
25
26
|
if (typeof (cmd === null || cmd === void 0 ? void 0 : cmd.toJSON) == 'undefined')
|
|
@@ -2,31 +2,27 @@ import { MessageCommandBuilder, MessageCommandExecuteData, MessageCommandExecute
|
|
|
2
2
|
import { SlashCommandBuilder, SlashCommandExecuteData, SlashCommandExecuteFunction, SlashCommandHaltData, SlashCommandHaltFunction } from '../classes/builders/SlashCommandBuilder';
|
|
3
3
|
import { Awaitable, PermissionResolvable, RestOrArray } from 'discord.js';
|
|
4
4
|
/**
|
|
5
|
-
* Any
|
|
5
|
+
* Any command builders
|
|
6
6
|
*/
|
|
7
7
|
export declare type AnyCommandBuilder = SlashCommandBuilder | MessageCommandBuilder;
|
|
8
8
|
/**
|
|
9
|
-
* Any
|
|
10
|
-
*/
|
|
11
|
-
export declare type AnyCommandExecuteData = SlashCommandExecuteData | MessageCommandExecuteData;
|
|
12
|
-
/**
|
|
13
|
-
* Any Reciple command halt functions
|
|
9
|
+
* Any command halt functions
|
|
14
10
|
*/
|
|
15
11
|
export declare type AnyCommandHaltFunction = SlashCommandHaltFunction | MessageCommandHaltFunction;
|
|
16
12
|
/**
|
|
17
|
-
* Any
|
|
13
|
+
* Any command execute function
|
|
18
14
|
*/
|
|
19
15
|
export declare type AnyCommandExecuteFunction = SlashCommandExecuteFunction | MessageCommandExecuteFunction;
|
|
20
16
|
/**
|
|
21
|
-
*
|
|
17
|
+
* command halt function
|
|
22
18
|
*/
|
|
23
19
|
export declare type CommandHaltFunction<T extends CommandBuilderType> = (haltData: T extends CommandBuilderType.SlashCommand ? SlashCommandHaltData : MessageCommandHaltData) => Awaitable<boolean | null | undefined | void>;
|
|
24
20
|
/**
|
|
25
|
-
*
|
|
21
|
+
* command execute function
|
|
26
22
|
*/
|
|
27
23
|
export declare type CommandExecuteFunction<T extends CommandBuilderType> = (executeData: T extends CommandBuilderType.SlashCommand ? SlashCommandExecuteData : MessageCommandExecuteData) => Awaitable<void>;
|
|
28
24
|
/**
|
|
29
|
-
* Types of
|
|
25
|
+
* Types of command builders
|
|
30
26
|
*/
|
|
31
27
|
export declare enum CommandBuilderType {
|
|
32
28
|
MessageCommand = 0,
|
|
@@ -1,41 +1,52 @@
|
|
|
1
1
|
import { MessageCommandExecuteData, MessageCommandHaltData } from '../classes/builders/MessageCommandBuilder';
|
|
2
2
|
import { SlashCommandExecuteData, SlashCommandHaltData } from '../classes/builders/SlashCommandBuilder';
|
|
3
3
|
import { MessageCommandOptionManager } from '../classes/MessageCommandOptionManager';
|
|
4
|
-
import { CommandBuilderType, AnyCommandExecuteData } from '../types/builders';
|
|
5
4
|
import { CooledDownUser } from '../classes/CommandCooldownManager';
|
|
5
|
+
import { RecipleClient } from '../classes/RecipleClient';
|
|
6
|
+
import { CommandBuilderType } from '../types/builders';
|
|
6
7
|
/**
|
|
7
|
-
* Any
|
|
8
|
+
* Any command halt data
|
|
8
9
|
*/
|
|
9
10
|
export declare type AnyCommandHaltData = SlashCommandHaltData | MessageCommandHaltData;
|
|
10
11
|
/**
|
|
11
|
-
*
|
|
12
|
+
* command halt data
|
|
12
13
|
*/
|
|
13
14
|
export declare type CommandHaltData<T extends CommandBuilderType> = CommandErrorData<T> | CommandCooldownData<T> | (T extends CommandBuilderType.SlashCommand ? never : CommandInvalidArguments<T> | CommandMissingArguments<T>) | CommandMissingMemberPermissions<T> | CommandMissingBotPermissions<T>;
|
|
14
15
|
/**
|
|
15
|
-
*
|
|
16
|
+
* Any command execute data
|
|
16
17
|
*/
|
|
17
|
-
export
|
|
18
|
+
export declare type AnyCommandExecuteData = SlashCommandExecuteData | MessageCommandExecuteData;
|
|
19
|
+
/**
|
|
20
|
+
* Command execute data
|
|
21
|
+
*/
|
|
22
|
+
export interface BaseCommandExecuteData {
|
|
23
|
+
client: RecipleClient<true>;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Command halt reason base
|
|
27
|
+
*/
|
|
28
|
+
export interface BaseCommandHaltData<T extends CommandBuilderType> {
|
|
18
29
|
executeData: T extends CommandBuilderType.SlashCommand ? SlashCommandExecuteData : T extends CommandBuilderType.MessageCommand ? MessageCommandExecuteData : AnyCommandExecuteData;
|
|
19
30
|
}
|
|
20
|
-
export interface CommandErrorData<T extends CommandBuilderType> extends
|
|
31
|
+
export interface CommandErrorData<T extends CommandBuilderType> extends BaseCommandHaltData<T> {
|
|
21
32
|
reason: CommandHaltReason.Error;
|
|
22
33
|
error: any;
|
|
23
34
|
}
|
|
24
|
-
export interface CommandCooldownData<T extends CommandBuilderType> extends
|
|
35
|
+
export interface CommandCooldownData<T extends CommandBuilderType> extends BaseCommandHaltData<T>, CooledDownUser {
|
|
25
36
|
reason: CommandHaltReason.Cooldown;
|
|
26
37
|
}
|
|
27
|
-
export interface CommandInvalidArguments<T extends CommandBuilderType> extends
|
|
38
|
+
export interface CommandInvalidArguments<T extends CommandBuilderType> extends BaseCommandHaltData<T> {
|
|
28
39
|
reason: CommandHaltReason.InvalidArguments;
|
|
29
40
|
invalidArguments: MessageCommandOptionManager;
|
|
30
41
|
}
|
|
31
|
-
export interface CommandMissingArguments<T extends CommandBuilderType> extends
|
|
42
|
+
export interface CommandMissingArguments<T extends CommandBuilderType> extends BaseCommandHaltData<T> {
|
|
32
43
|
reason: CommandHaltReason.MissingArguments;
|
|
33
44
|
missingArguments: MessageCommandOptionManager;
|
|
34
45
|
}
|
|
35
|
-
export interface CommandMissingMemberPermissions<T extends CommandBuilderType> extends
|
|
46
|
+
export interface CommandMissingMemberPermissions<T extends CommandBuilderType> extends BaseCommandHaltData<T> {
|
|
36
47
|
reason: CommandHaltReason.MissingMemberPermissions;
|
|
37
48
|
}
|
|
38
|
-
export interface CommandMissingBotPermissions<T extends CommandBuilderType> extends
|
|
49
|
+
export interface CommandMissingBotPermissions<T extends CommandBuilderType> extends BaseCommandHaltData<T> {
|
|
39
50
|
reason: CommandHaltReason.MissingBotPermissions;
|
|
40
51
|
}
|
|
41
52
|
/**
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "reciple",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.1.0",
|
|
4
4
|
"bin": "bin/bin.js",
|
|
5
5
|
"license": "GPL-3.0",
|
|
6
6
|
"main": "bin/index.js",
|
|
7
|
+
"typings": "bin/index.d.ts",
|
|
7
8
|
"author": "FalloutStudios",
|
|
8
9
|
"description": "Handler for Discord.js",
|
|
9
10
|
"homepage": "https://reciple.js.org",
|
|
@@ -56,18 +57,18 @@
|
|
|
56
57
|
"yaml": "^2.1.1"
|
|
57
58
|
},
|
|
58
59
|
"devDependencies": {
|
|
59
|
-
"@types/node": "^18.
|
|
60
|
-
"@types/semver": "^7.3.
|
|
61
|
-
"discord.js": "^14.
|
|
60
|
+
"@types/node": "^18.7.1",
|
|
61
|
+
"@types/semver": "^7.3.11",
|
|
62
|
+
"discord.js": "^14.2.0",
|
|
62
63
|
"rimraf": "^3.0.2",
|
|
63
|
-
"typedoc": "^0.23.
|
|
64
|
+
"typedoc": "^0.23.10",
|
|
64
65
|
"typedoc-plugin-discord-types": "^1.0.2",
|
|
65
66
|
"typedoc-plugin-djs-links": "^1.2.0",
|
|
66
67
|
"typedoc-plugin-mdn-links": "^2.0.0",
|
|
67
68
|
"typescript": "^4.7.4"
|
|
68
69
|
},
|
|
69
70
|
"peerDependencies": {
|
|
70
|
-
"discord.js": "^14.
|
|
71
|
+
"discord.js": "^14.2.0"
|
|
71
72
|
},
|
|
72
73
|
"packageManager": "yarn@3.2.2"
|
|
73
74
|
}
|
package/resource/reciple.yml
CHANGED
|
@@ -23,8 +23,9 @@ commands:
|
|
|
23
23
|
# enable overwriten command permissions
|
|
24
24
|
enabled: false
|
|
25
25
|
commands:
|
|
26
|
-
- command:
|
|
27
|
-
permissions:
|
|
26
|
+
- command: example-command
|
|
27
|
+
permissions:
|
|
28
|
+
- Administrator
|
|
28
29
|
|
|
29
30
|
# Interaction command options
|
|
30
31
|
slashCommand:
|
|
@@ -45,8 +46,9 @@ commands:
|
|
|
45
46
|
# enable overwriten command permissions
|
|
46
47
|
enabled: false
|
|
47
48
|
commands:
|
|
48
|
-
- command:
|
|
49
|
-
permissions:
|
|
49
|
+
- command: example-command
|
|
50
|
+
permissions:
|
|
51
|
+
- Administrator
|
|
50
52
|
|
|
51
53
|
|
|
52
54
|
# Logger options
|
|
@@ -60,32 +62,32 @@ fileLogging:
|
|
|
60
62
|
# stringify logged JSONs
|
|
61
63
|
stringifyLoggedJSON: false
|
|
62
64
|
# log file path
|
|
63
|
-
logFilePath:
|
|
65
|
+
logFilePath: logs/latest.log
|
|
64
66
|
|
|
65
67
|
# Client options
|
|
66
68
|
# Learn more about client options at https://discord.js.org/#/docs/discord.js/main/typedef/ClientOptions
|
|
67
69
|
client:
|
|
68
70
|
intents:
|
|
69
|
-
-
|
|
70
|
-
-
|
|
71
|
-
-
|
|
72
|
-
-
|
|
71
|
+
- Guilds
|
|
72
|
+
- GuildMembers
|
|
73
|
+
- GuildMessages
|
|
74
|
+
- MessageContent
|
|
73
75
|
|
|
74
76
|
# Bot messages
|
|
75
77
|
messages:
|
|
76
|
-
missingArguments:
|
|
77
|
-
invalidArguments:
|
|
78
|
+
missingArguments: Not enough arguments.
|
|
79
|
+
invalidArguments: Invalid argument(s) given.
|
|
78
80
|
insufficientBotPerms:
|
|
79
|
-
content:
|
|
81
|
+
content: Insufficient bot permissions.
|
|
80
82
|
ephemeral: true
|
|
81
83
|
noPermissions:
|
|
82
|
-
content:
|
|
84
|
+
content: You do not have permission to use this command.
|
|
83
85
|
ephemeral: true
|
|
84
86
|
cooldown:
|
|
85
|
-
content:
|
|
87
|
+
content: You cannot execute this command right now due to the cooldown.
|
|
86
88
|
ephemeral: true
|
|
87
89
|
error:
|
|
88
|
-
content:
|
|
90
|
+
content: An error occurred.
|
|
89
91
|
ephemeral: true
|
|
90
92
|
|
|
91
93
|
# Ignored Files
|