reciple 6.0.0-dev.25 → 6.0.0-dev.26

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.
Files changed (46) hide show
  1. package/LICENSE +674 -674
  2. package/README.md +183 -183
  3. package/dist/lib/bin.mjs +67 -66
  4. package/dist/lib/esm.mjs +1 -1
  5. package/dist/lib/index.js +33 -33
  6. package/dist/lib/reciple/classes/RecipleClient.js +307 -296
  7. package/dist/lib/reciple/classes/RecipleConfig.js +106 -106
  8. package/dist/lib/reciple/classes/RecipleModule.js +94 -94
  9. package/dist/lib/reciple/classes/builders/MessageCommandBuilder.js +309 -309
  10. package/dist/lib/reciple/classes/builders/MessageCommandOptionBuilder.js +126 -126
  11. package/dist/lib/reciple/classes/builders/SlashCommandBuilder.js +246 -246
  12. package/dist/lib/reciple/classes/managers/ApplicationCommandManager.js +178 -178
  13. package/dist/lib/reciple/classes/managers/CommandCooldownManager.js +99 -99
  14. package/dist/lib/reciple/classes/managers/CommandManager.js +60 -59
  15. package/dist/lib/reciple/classes/managers/MessageCommandOptionManager.js +25 -25
  16. package/dist/lib/reciple/classes/managers/ModuleManager.js +176 -176
  17. package/dist/lib/reciple/flags.js +31 -31
  18. package/dist/lib/reciple/permissions.js +30 -30
  19. package/dist/lib/reciple/types/builders.js +11 -11
  20. package/dist/lib/reciple/types/commands.js +15 -15
  21. package/dist/lib/reciple/types/paramOptions.js +2 -2
  22. package/dist/lib/reciple/util.js +71 -69
  23. package/dist/lib/reciple/version.js +47 -47
  24. package/dist/types/bin.d.mts +2 -2
  25. package/dist/types/esm.d.mts +1 -1
  26. package/dist/types/index.d.ts +17 -17
  27. package/dist/types/reciple/classes/RecipleClient.d.ts +114 -104
  28. package/dist/types/reciple/classes/RecipleConfig.d.ts +100 -100
  29. package/dist/types/reciple/classes/RecipleModule.d.ts +56 -56
  30. package/dist/types/reciple/classes/builders/MessageCommandBuilder.d.ts +189 -189
  31. package/dist/types/reciple/classes/builders/MessageCommandOptionBuilder.d.ts +53 -53
  32. package/dist/types/reciple/classes/builders/SlashCommandBuilder.d.ts +98 -98
  33. package/dist/types/reciple/classes/managers/ApplicationCommandManager.d.ts +53 -53
  34. package/dist/types/reciple/classes/managers/CommandCooldownManager.d.ts +70 -70
  35. package/dist/types/reciple/classes/managers/CommandManager.d.ts +34 -34
  36. package/dist/types/reciple/classes/managers/MessageCommandOptionManager.d.ts +22 -22
  37. package/dist/types/reciple/classes/managers/ModuleManager.d.ts +49 -49
  38. package/dist/types/reciple/flags.d.ts +17 -17
  39. package/dist/types/reciple/permissions.d.ts +15 -15
  40. package/dist/types/reciple/types/builders.d.ts +205 -205
  41. package/dist/types/reciple/types/commands.d.ts +81 -81
  42. package/dist/types/reciple/types/paramOptions.d.ts +101 -101
  43. package/dist/types/reciple/util.d.ts +26 -26
  44. package/dist/types/reciple/version.d.ts +25 -25
  45. package/package.json +2 -2
  46. package/resource/reciple.yml +120 -120
@@ -1,11 +1,11 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CommandType = void 0;
4
- /**
5
- * Types of command builders
6
- */
7
- var CommandType;
8
- (function (CommandType) {
9
- CommandType[CommandType["SlashCommand"] = 1] = "SlashCommand";
10
- CommandType[CommandType["MessageCommand"] = 2] = "MessageCommand";
11
- })(CommandType = exports.CommandType || (exports.CommandType = {}));
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CommandType = void 0;
4
+ /**
5
+ * Types of command builders
6
+ */
7
+ var CommandType;
8
+ (function (CommandType) {
9
+ CommandType[CommandType["SlashCommand"] = 1] = "SlashCommand";
10
+ CommandType[CommandType["MessageCommand"] = 2] = "MessageCommand";
11
+ })(CommandType = exports.CommandType || (exports.CommandType = {}));
@@ -1,15 +1,15 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CommandHaltReason = void 0;
4
- /**
5
- * Command halt reasons
6
- */
7
- var CommandHaltReason;
8
- (function (CommandHaltReason) {
9
- CommandHaltReason[CommandHaltReason["Error"] = 1] = "Error";
10
- CommandHaltReason[CommandHaltReason["Cooldown"] = 2] = "Cooldown";
11
- CommandHaltReason[CommandHaltReason["InvalidArguments"] = 3] = "InvalidArguments";
12
- CommandHaltReason[CommandHaltReason["MissingArguments"] = 4] = "MissingArguments";
13
- CommandHaltReason[CommandHaltReason["MissingMemberPermissions"] = 5] = "MissingMemberPermissions";
14
- CommandHaltReason[CommandHaltReason["MissingBotPermissions"] = 6] = "MissingBotPermissions";
15
- })(CommandHaltReason = exports.CommandHaltReason || (exports.CommandHaltReason = {}));
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CommandHaltReason = void 0;
4
+ /**
5
+ * Command halt reasons
6
+ */
7
+ var CommandHaltReason;
8
+ (function (CommandHaltReason) {
9
+ CommandHaltReason[CommandHaltReason["Error"] = 1] = "Error";
10
+ CommandHaltReason[CommandHaltReason["Cooldown"] = 2] = "Cooldown";
11
+ CommandHaltReason[CommandHaltReason["InvalidArguments"] = 3] = "InvalidArguments";
12
+ CommandHaltReason[CommandHaltReason["MissingArguments"] = 4] = "MissingArguments";
13
+ CommandHaltReason[CommandHaltReason["MissingMemberPermissions"] = 5] = "MissingMemberPermissions";
14
+ CommandHaltReason[CommandHaltReason["MissingBotPermissions"] = 6] = "MissingBotPermissions";
15
+ })(CommandHaltReason = exports.CommandHaltReason || (exports.CommandHaltReason = {}));
@@ -1,2 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,69 +1,71 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.path = exports.createLogger = exports.validateCommandBuilder = exports.deprecationWarning = exports.isClass = void 0;
7
- const fallout_utility_1 = require("fallout-utility");
8
- const builders_1 = require("./types/builders");
9
- const flags_1 = require("./flags");
10
- const chalk_1 = __importDefault(require("chalk"));
11
- const path_1 = __importDefault(require("path"));
12
- /**
13
- * Check if an object is a class
14
- * @param object Object to identify
15
- */
16
- function isClass(object) {
17
- const isClassConstructor = object.constructor && object.constructor.toString().substring(0, 5) === 'class';
18
- if (object.prototype === undefined)
19
- return isClassConstructor;
20
- const isPrototypeClassConstructor = object.prototype.constructor && object.prototype.constructor.toString && object.prototype.constructor.toString().substring(0, 5) === 'class';
21
- return isClassConstructor || isPrototypeClassConstructor;
22
- }
23
- exports.isClass = isClass;
24
- /**
25
- * Emit process warning about deprecated method/function
26
- * @param content Warning content
27
- */
28
- function deprecationWarning(content) {
29
- process.emitWarning(content, 'DeprecationWarning');
30
- }
31
- exports.deprecationWarning = deprecationWarning;
32
- function validateCommandBuilder(command) {
33
- if (!command.name)
34
- return false;
35
- if (command.type === builders_1.CommandType.MessageCommand && command.options.length && command.options.some(o => !o.name))
36
- return false;
37
- return true;
38
- }
39
- exports.validateCommandBuilder = validateCommandBuilder;
40
- /**
41
- * Create new logger
42
- * @param stringifyJSON stringify json objects in console
43
- * @param debugmode display debug messages
44
- * @param colorizeMessage add logger colours to messages
45
- */
46
- function createLogger(stringifyJSON, debugmode = false, colorizeMessage = true) {
47
- return new fallout_utility_1.Logger({
48
- stringifyJSON: stringifyJSON,
49
- enableDebugMode: flags_1.flags.debugmode ?? debugmode,
50
- loggerName: 'Main',
51
- prefixes: {
52
- [fallout_utility_1.LogLevels.INFO]: (name) => `[${new Date().toLocaleTimeString(undefined, { hour12: false })}][${(name ? name + '/' : '') + 'INFO'}]`,
53
- [fallout_utility_1.LogLevels.WARN]: (name) => `[${chalk_1.default.yellow(new Date().toLocaleTimeString(undefined, { hour12: false }))}][${chalk_1.default.yellow((name ? name + '/' : '') + 'WARN')}]`,
54
- [fallout_utility_1.LogLevels.ERROR]: (name) => `[${chalk_1.default.red(new Date().toLocaleTimeString(undefined, { hour12: false }))}][${chalk_1.default.red((name ? name + '/' : '') + 'ERROR')}]`,
55
- [fallout_utility_1.LogLevels.DEBUG]: (name) => `[${chalk_1.default.blue(new Date().toLocaleTimeString(undefined, { hour12: false }))}][${chalk_1.default.blue((name ? name + '/' : '') + 'DEBUG')}]`,
56
- },
57
- colorMessages: {
58
- [fallout_utility_1.LogLevels.INFO]: (message) => message,
59
- [fallout_utility_1.LogLevels.WARN]: (message) => (!colorizeMessage ? message : chalk_1.default.yellow(message)),
60
- [fallout_utility_1.LogLevels.ERROR]: (message) => (!colorizeMessage ? message : chalk_1.default.red(message)),
61
- [fallout_utility_1.LogLevels.DEBUG]: (message) => (!colorizeMessage ? message : chalk_1.default.blue(message)),
62
- },
63
- });
64
- }
65
- exports.createLogger = createLogger;
66
- /**
67
- * Path module that depending on os
68
- */
69
- exports.path = (0, fallout_utility_1.getOperatingSystem)() === fallout_utility_1.OS.WINDOWS ? path_1.default.win32 : path_1.default.posix;
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.path = exports.createLogger = exports.validateCommandBuilder = exports.deprecationWarning = exports.isClass = void 0;
7
+ const fallout_utility_1 = require("fallout-utility");
8
+ const builders_1 = require("./types/builders");
9
+ const flags_1 = require("./flags");
10
+ const chalk_1 = __importDefault(require("chalk"));
11
+ const path_1 = __importDefault(require("path"));
12
+ /**
13
+ * Check if an object is a class
14
+ * @param object Object to identify
15
+ */
16
+ function isClass(object) {
17
+ const isClassConstructor = object.constructor && object.constructor.toString().substring(0, 5) === 'class';
18
+ if (object.prototype === undefined)
19
+ return isClassConstructor;
20
+ const isPrototypeClassConstructor = object.prototype.constructor && object.prototype.constructor.toString && object.prototype.constructor.toString().substring(0, 5) === 'class';
21
+ return isClassConstructor || isPrototypeClassConstructor;
22
+ }
23
+ exports.isClass = isClass;
24
+ /**
25
+ * Emit process warning about deprecated method/function
26
+ * @param content Warning content
27
+ */
28
+ function deprecationWarning(content) {
29
+ process.emitWarning(content, 'DeprecationWarning');
30
+ }
31
+ exports.deprecationWarning = deprecationWarning;
32
+ function validateCommandBuilder(command) {
33
+ if (!command.name)
34
+ return false;
35
+ if (command.type === builders_1.CommandType.MessageCommand && command.options.length && command.options.some(o => !o.name))
36
+ return false;
37
+ return true;
38
+ }
39
+ exports.validateCommandBuilder = validateCommandBuilder;
40
+ /**
41
+ * Create new logger
42
+ * @param stringifyJSON stringify json objects in console
43
+ * @param debugmode display debug messages
44
+ * @param colorizeMessage add logger colours to messages
45
+ */
46
+ function createLogger(stringifyJSON, debugmode = false, colorizeMessage = true) {
47
+ return new fallout_utility_1.Logger({
48
+ stringifyJSON: stringifyJSON,
49
+ enableDebugMode: flags_1.flags.debugmode ?? debugmode,
50
+ loggerName: 'Main',
51
+ prefixes: {
52
+ [fallout_utility_1.LogLevels.INFO]: (name) => `[${new Date().toLocaleTimeString(undefined, { hour12: false })}][${(name ? name + '/' : '') + 'INFO'}]`,
53
+ [fallout_utility_1.LogLevels.WARN]: (name) => `[${chalk_1.default.yellow(new Date().toLocaleTimeString(undefined, { hour12: false }))}][${chalk_1.default.yellow((name ? name + '/' : '') + 'WARN')}]`,
54
+ [fallout_utility_1.LogLevels.ERROR]: (name) => `[${chalk_1.default.red(new Date().toLocaleTimeString(undefined, { hour12: false }))}][${chalk_1.default.red((name ? name + '/' : '') + 'ERROR')}]`,
55
+ [fallout_utility_1.LogLevels.DEBUG]: (name) => `[${chalk_1.default.blue(new Date().toLocaleTimeString(undefined, { hour12: false }))}][${chalk_1.default.blue((name ? name + '/' : '') + 'DEBUG')}]`,
56
+ },
57
+ colorMessages: {
58
+ [fallout_utility_1.LogLevels.INFO]: (message) => message,
59
+ [fallout_utility_1.LogLevels.WARN]: (message) => (!colorizeMessage ? message : chalk_1.default.yellow(message)),
60
+ [fallout_utility_1.LogLevels.ERROR]: (message) => (!colorizeMessage ? message : chalk_1.default.red(message)),
61
+ [fallout_utility_1.LogLevels.DEBUG]: (message) => (!colorizeMessage ? message : chalk_1.default.blue(message)),
62
+ },
63
+ ObjectInspectDepth: 3,
64
+ ObjectInspectColorized: colorizeMessage,
65
+ });
66
+ }
67
+ exports.createLogger = createLogger;
68
+ /**
69
+ * Path module that depending on os
70
+ */
71
+ exports.path = (0, fallout_utility_1.getOperatingSystem)() === fallout_utility_1.OS.WINDOWS ? path_1.default.win32 : path_1.default.posix;
@@ -1,47 +1,47 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.isSupportedVersion = exports.parseVersion = exports.isValidVersion = exports.rawVersion = exports.version = void 0;
7
- const semver_1 = __importDefault(require("semver"));
8
- /**
9
- * Current reciple version
10
- */
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;
16
- /**
17
- * Check if the version is valid
18
- * @param ver Version string to validated
19
- */
20
- function isValidVersion(ver) {
21
- return semver_1.default.valid(semver_1.default.coerce(ver)) !== null;
22
- }
23
- exports.isValidVersion = isValidVersion;
24
- /**
25
- * Parse the version string
26
- * @param ver Parse version string
27
- */
28
- function parseVersion(ver) {
29
- if (!isValidVersion(ver))
30
- throw new TypeError(`Invalid version: ${ver}`);
31
- return semver_1.default.parse(ver);
32
- }
33
- exports.parseVersion = parseVersion;
34
- /**
35
- * Check if the given version is supported by the given version range
36
- * @param versionRange Version range
37
- * @param supportedVersion Version to match given version range
38
- */
39
- function isSupportedVersion(versionRange, supportedVersion) {
40
- supportedVersion = supportedVersion || exports.version;
41
- if (!isValidVersion(versionRange))
42
- throw new TypeError(`Invalid version: ${versionRange}`);
43
- if (!isValidVersion(supportedVersion))
44
- throw new TypeError(`Invalid supported version: ${supportedVersion}`);
45
- return semver_1.default.satisfies(supportedVersion, versionRange);
46
- }
47
- exports.isSupportedVersion = isSupportedVersion;
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.isSupportedVersion = exports.parseVersion = exports.isValidVersion = exports.rawVersion = exports.version = void 0;
7
+ const semver_1 = __importDefault(require("semver"));
8
+ /**
9
+ * Current reciple version
10
+ */
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;
16
+ /**
17
+ * Check if the version is valid
18
+ * @param ver Version string to validated
19
+ */
20
+ function isValidVersion(ver) {
21
+ return semver_1.default.valid(semver_1.default.coerce(ver)) !== null;
22
+ }
23
+ exports.isValidVersion = isValidVersion;
24
+ /**
25
+ * Parse the version string
26
+ * @param ver Parse version string
27
+ */
28
+ function parseVersion(ver) {
29
+ if (!isValidVersion(ver))
30
+ throw new TypeError(`Invalid version: ${ver}`);
31
+ return semver_1.default.parse(ver);
32
+ }
33
+ exports.parseVersion = parseVersion;
34
+ /**
35
+ * Check if the given version is supported by the given version range
36
+ * @param versionRange Version range
37
+ * @param supportedVersion Version to match given version range
38
+ */
39
+ function isSupportedVersion(versionRange, supportedVersion) {
40
+ supportedVersion = supportedVersion || exports.version;
41
+ if (!isValidVersion(versionRange))
42
+ throw new TypeError(`Invalid version: ${versionRange}`);
43
+ if (!isValidVersion(supportedVersion))
44
+ throw new TypeError(`Invalid supported version: ${supportedVersion}`);
45
+ return semver_1.default.satisfies(supportedVersion, versionRange);
46
+ }
47
+ exports.isSupportedVersion = isSupportedVersion;
@@ -1,2 +1,2 @@
1
- #!/usr/bin/env node
2
- import 'dotenv/config';
1
+ #!/usr/bin/env node
2
+ import 'dotenv/config';
@@ -1 +1 @@
1
- export * from './index.js';
1
+ export * from './index.js';
@@ -1,17 +1,17 @@
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/CommandCooldownManager.js';
6
- export * from './reciple/classes/managers/CommandManager.js';
7
- export * from './reciple/classes/managers/MessageCommandOptionManager.js';
8
- export * from './reciple/classes/managers/ModuleManager.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/flags';
15
- export * from './reciple/permissions.js';
16
- export * from './reciple/util.js';
17
- export * from './reciple/version.js';
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/CommandCooldownManager.js';
6
+ export * from './reciple/classes/managers/CommandManager.js';
7
+ export * from './reciple/classes/managers/MessageCommandOptionManager.js';
8
+ export * from './reciple/classes/managers/ModuleManager.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/flags';
15
+ export * from './reciple/permissions.js';
16
+ export * from './reciple/util.js';
17
+ export * from './reciple/version.js';
@@ -1,104 +1,114 @@
1
- import { Awaitable, ChatInputCommandInteraction, Client, ClientEvents, ClientOptions, Interaction, Message } from 'discord.js';
2
- import { MessageCommandBuilder, MessageCommandExecuteData, MessageCommandHaltData } from './builders/MessageCommandBuilder';
3
- import { SlashCommandExecuteData, SlashCommandHaltData } from './builders/SlashCommandBuilder';
4
- import { AnyCommandExecuteData, AnyCommandHaltData } from '../types/commands';
5
- import { CommandCooldownManager } from './managers/CommandCooldownManager';
6
- import { AnySlashCommandBuilder } from '../types/builders';
7
- import { ApplicationCommandManager } from './managers/ApplicationCommandManager';
8
- import { CommandManager } from './managers/CommandManager';
9
- import { ModuleManager } from './managers/ModuleManager';
10
- import { Config } from './RecipleConfig';
11
- import { Logger } from 'fallout-utility';
12
- /**
13
- * Options for {@link RecipleClient}
14
- */
15
- export interface RecipleClientOptions extends ClientOptions {
16
- config?: Config;
17
- cwd?: string;
18
- }
19
- /**
20
- * Reciple client events
21
- */
22
- export interface RecipleClientEvents extends ClientEvents {
23
- recipleCommandExecute: [executeData: AnyCommandExecuteData];
24
- recipleCommandHalt: [haltData: AnyCommandHaltData];
25
- recipleRegisterApplicationCommands: [];
26
- recipleReplyError: [error: unknown];
27
- }
28
- /**
29
- * Reciple client
30
- */
31
- export interface RecipleClient<Ready extends boolean = boolean> extends Client<Ready> {
32
- on<E extends keyof RecipleClientEvents>(event: E, listener: (...args: RecipleClientEvents[E]) => Awaitable<void>): this;
33
- on<E extends string | symbol>(event: E, listener: (...args: any) => Awaitable<void>): this;
34
- once<E extends keyof RecipleClientEvents>(event: E, listener: (...args: RecipleClientEvents[E]) => Awaitable<void>): this;
35
- once<E extends keyof string | symbol>(event: E, listener: (...args: any) => Awaitable<void>): this;
36
- emit<E extends keyof RecipleClientEvents>(event: E, ...args: RecipleClientEvents[E]): boolean;
37
- emit<E extends string | symbol>(event: E, ...args: any): boolean;
38
- off<E extends keyof RecipleClientEvents>(event: E, listener: (...args: RecipleClientEvents[E]) => Awaitable<void>): this;
39
- off<E extends string | symbol>(event: E, listener: (...args: any) => Awaitable<void>): this;
40
- removeAllListeners<E extends keyof RecipleClientEvents>(event?: E): this;
41
- removeAllListeners(event?: string | symbol): this;
42
- isReady(): this is RecipleClient<true>;
43
- }
44
- export declare class RecipleClient<Ready extends boolean = boolean> extends Client<Ready> {
45
- readonly config: Config;
46
- readonly commands: CommandManager;
47
- readonly applicationCommands: ApplicationCommandManager;
48
- readonly cooldowns: CommandCooldownManager;
49
- readonly modules: ModuleManager;
50
- readonly cwd: string;
51
- readonly logger: Logger;
52
- readonly version: string;
53
- get isClientLogsSilent(): boolean;
54
- /**
55
- * @param options Client options
56
- */
57
- constructor(options: RecipleClientOptions);
58
- /**
59
- * Listed to command executions
60
- */
61
- addCommandListeners(): RecipleClient<Ready>;
62
- /**
63
- * Execute a slash command
64
- * @param interaction Slash command interaction
65
- */
66
- slashCommandExecute(interaction: Interaction | ChatInputCommandInteraction): Promise<undefined | SlashCommandExecuteData>;
67
- /**
68
- * Execute a Message command
69
- * @param message Message command executor
70
- * @param prefix Message command prefix
71
- */
72
- messageCommandExecute(message: Message, prefix?: string): Promise<undefined | MessageCommandExecuteData>;
73
- /**
74
- * Get a message from config
75
- * @param messageKey Config messages key
76
- * @param defaultMessage Default message when the key does not exists
77
- */
78
- getConfigMessage<T = unknown>(messageKey: string, defaultMessage?: T): T;
79
- /**
80
- * Emits the {@link RecipleClientEvents["recipleReplyError"]} event
81
- * @param error Received Error
82
- */
83
- protected _replyError(error: unknown): void;
84
- /**
85
- * Executes command halt function
86
- * @param command Halted command's builder
87
- * @param haltData Halted command's data
88
- */
89
- protected _haltCommand(command: AnySlashCommandBuilder, haltData: SlashCommandHaltData): Promise<boolean>;
90
- protected _haltCommand(command: MessageCommandBuilder, haltData: MessageCommandHaltData): Promise<boolean>;
91
- /**
92
- * Executes a command's {@link SharedCommandBuilderProperties["execute"]} method
93
- * @param command Command builder
94
- * @param executeData Command execute data
95
- */
96
- protected _executeCommand(command: AnySlashCommandBuilder, executeData: SlashCommandExecuteData): Promise<SlashCommandExecuteData | undefined>;
97
- protected _executeCommand(command: MessageCommandBuilder, executeData: MessageCommandExecuteData): Promise<MessageCommandExecuteData | undefined>;
98
- /**
99
- * Error message when a command fails to execute
100
- * @param err Received error
101
- * @param command Slash/Message command execute data
102
- */
103
- protected _commandExecuteError(err: Error, command: AnyCommandExecuteData): Promise<void>;
104
- }
1
+ import { Awaitable, ChatInputCommandInteraction, Client, ClientEvents, ClientOptions, Interaction, Message } from 'discord.js';
2
+ import { MessageCommandBuilder, MessageCommandExecuteData, MessageCommandHaltData } from './builders/MessageCommandBuilder';
3
+ import { SlashCommandExecuteData, SlashCommandHaltData } from './builders/SlashCommandBuilder';
4
+ import { AnyCommandExecuteData, AnyCommandHaltData } from '../types/commands';
5
+ import { CommandCooldownManager } from './managers/CommandCooldownManager';
6
+ import { AnySlashCommandBuilder } from '../types/builders';
7
+ import { ApplicationCommandManager } from './managers/ApplicationCommandManager';
8
+ import { CommandManager } from './managers/CommandManager';
9
+ import { ModuleManager } from './managers/ModuleManager';
10
+ import { Config } from './RecipleConfig';
11
+ import { Logger } from 'fallout-utility';
12
+ /**
13
+ * Options for {@link RecipleClient}
14
+ */
15
+ export interface RecipleClientOptions extends ClientOptions {
16
+ config?: Config;
17
+ cwd?: string;
18
+ }
19
+ /**
20
+ * Reciple client events
21
+ */
22
+ export interface RecipleClientEvents extends ClientEvents {
23
+ recipleCommandExecute: [executeData: AnyCommandExecuteData];
24
+ recipleCommandHalt: [haltData: AnyCommandHaltData];
25
+ recipleRegisterApplicationCommands: [];
26
+ recipleReplyError: [error: unknown];
27
+ }
28
+ export declare enum RecipleEvents {
29
+ RecipleCommandExecute = "recipleCommandExecute",
30
+ RecipleCommandHalt = "recipleCommandHalt",
31
+ RecipleRegisterApplicationCommands = "recipleRegisterApplicationCommands",
32
+ RecipleReplyError = "recipleReplyError",
33
+ CommandExecute = "recipleCommandExecute",
34
+ CommandHalt = "recipleCommandHalt",
35
+ RegisterApplicationCommands = "recipleRegisterApplicationCommands",
36
+ ReplyError = "recipleReplyError"
37
+ }
38
+ /**
39
+ * Reciple client
40
+ */
41
+ export interface RecipleClient<Ready extends boolean = boolean> extends Client<Ready> {
42
+ on<E extends keyof RecipleClientEvents>(event: E, listener: (...args: RecipleClientEvents[E]) => Awaitable<void>): this;
43
+ on<E extends string | symbol>(event: E, listener: (...args: any) => Awaitable<void>): this;
44
+ once<E extends keyof RecipleClientEvents>(event: E, listener: (...args: RecipleClientEvents[E]) => Awaitable<void>): this;
45
+ once<E extends keyof string | symbol>(event: E, listener: (...args: any) => Awaitable<void>): this;
46
+ emit<E extends keyof RecipleClientEvents>(event: E, ...args: RecipleClientEvents[E]): boolean;
47
+ emit<E extends string | symbol>(event: E, ...args: any): boolean;
48
+ off<E extends keyof RecipleClientEvents>(event: E, listener: (...args: RecipleClientEvents[E]) => Awaitable<void>): this;
49
+ off<E extends string | symbol>(event: E, listener: (...args: any) => Awaitable<void>): this;
50
+ removeAllListeners<E extends keyof RecipleClientEvents>(event?: E): this;
51
+ removeAllListeners(event?: string | symbol): this;
52
+ isReady(): this is RecipleClient<true>;
53
+ }
54
+ export declare class RecipleClient<Ready extends boolean = boolean> extends Client<Ready> {
55
+ readonly config: Config;
56
+ readonly commands: CommandManager;
57
+ readonly applicationCommands: ApplicationCommandManager;
58
+ readonly cooldowns: CommandCooldownManager;
59
+ readonly modules: ModuleManager;
60
+ readonly cwd: string;
61
+ readonly logger: Logger;
62
+ readonly version: string;
63
+ get isClientLogsSilent(): boolean;
64
+ /**
65
+ * @param options Client options
66
+ */
67
+ constructor(options: RecipleClientOptions);
68
+ /**
69
+ * Listed to command executions
70
+ */
71
+ addCommandListeners(): RecipleClient<Ready>;
72
+ /**
73
+ * Execute a slash command
74
+ * @param interaction Slash command interaction
75
+ */
76
+ slashCommandExecute(interaction: Interaction | ChatInputCommandInteraction): Promise<undefined | SlashCommandExecuteData>;
77
+ /**
78
+ * Execute a Message command
79
+ * @param message Message command executor
80
+ * @param prefix Message command prefix
81
+ */
82
+ messageCommandExecute(message: Message, prefix?: string): Promise<undefined | MessageCommandExecuteData>;
83
+ /**
84
+ * Get a message from config
85
+ * @param messageKey Config messages key
86
+ * @param defaultMessage Default message when the key does not exists
87
+ */
88
+ getConfigMessage<T = unknown>(messageKey: string, defaultMessage?: T): T;
89
+ /**
90
+ * Emits the {@link RecipleClientEvents["recipleReplyError"]} event
91
+ * @param error Received Error
92
+ */
93
+ protected _replyError(error: unknown): void;
94
+ /**
95
+ * Executes command halt function
96
+ * @param command Halted command's builder
97
+ * @param haltData Halted command's data
98
+ */
99
+ protected _haltCommand(command: AnySlashCommandBuilder, haltData: SlashCommandHaltData): Promise<boolean>;
100
+ protected _haltCommand(command: MessageCommandBuilder, haltData: MessageCommandHaltData): Promise<boolean>;
101
+ /**
102
+ * Executes a command's {@link SharedCommandBuilderProperties["execute"]} method
103
+ * @param command Command builder
104
+ * @param executeData Command execute data
105
+ */
106
+ protected _executeCommand(command: AnySlashCommandBuilder, executeData: SlashCommandExecuteData): Promise<SlashCommandExecuteData | undefined>;
107
+ protected _executeCommand(command: MessageCommandBuilder, executeData: MessageCommandExecuteData): Promise<MessageCommandExecuteData | undefined>;
108
+ /**
109
+ * Error message when a command fails to execute
110
+ * @param err Received error
111
+ * @param command Slash/Message command execute data
112
+ */
113
+ protected _commandExecuteError(err: Error, command: AnyCommandExecuteData): Promise<void>;
114
+ }