reciple 6.0.0-dev.8 → 6.0.0-dev.9

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/cjs/bin.js CHANGED
@@ -39,6 +39,8 @@ if (!client.isClientLogsSilent)
39
39
  }));
40
40
  client.on('ready', async () => {
41
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`);
42
44
  if (client.config.commands.slashCommand.registerCommands)
43
45
  await client.commands.registerApplicationCommands();
44
46
  if (!client.isClientLogsSilent)
package/dist/cjs/index.js CHANGED
@@ -18,9 +18,9 @@ __exportStar(require("./reciple/classes/builders/MessageCommandBuilder"), export
18
18
  __exportStar(require("./reciple/classes/builders/MessageCommandOptionBuilder"), exports);
19
19
  __exportStar(require("./reciple/classes/builders/SlashCommandBuilder"), exports);
20
20
  __exportStar(require("./reciple/classes/managers/ApplicationCommandManager"), exports);
21
- __exportStar(require("./reciple/classes/managers/CommandCooldownManager"), exports);
22
21
  __exportStar(require("./reciple/classes/managers/ClientCommandManager"), exports);
23
22
  __exportStar(require("./reciple/classes/managers/ClientModuleManager"), exports);
23
+ __exportStar(require("./reciple/classes/managers/CommandCooldownManager"), exports);
24
24
  __exportStar(require("./reciple/classes/managers/MessageCommandOptionManager"), exports);
25
25
  __exportStar(require("./reciple/classes/RecipleClient"), exports);
26
26
  __exportStar(require("./reciple/classes/RecipleConfig"), exports);
@@ -12,9 +12,9 @@ const CommandCooldownManager_1 = require("./managers/CommandCooldownManager");
12
12
  const permissions_1 = require("../permissions");
13
13
  const MessageCommandOptionManager_1 = require("./managers/MessageCommandOptionManager");
14
14
  const ApplicationCommandManager_1 = require("./managers/ApplicationCommandManager");
15
- const builders_1 = require("../types/builders");
16
15
  const ClientCommandManager_1 = require("./managers/ClientCommandManager");
17
16
  const ClientModuleManager_1 = require("./managers/ClientModuleManager");
17
+ 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");
@@ -68,7 +68,7 @@ class RecipleClient extends discord_js_1.Client {
68
68
  return;
69
69
  if (!this.config.commands.slashCommand.acceptRepliedInteractions && (interaction.replied || interaction.deferred))
70
70
  return;
71
- const command = this.commands.get(interaction.commandName, builders_1.CommandBuilderType.SlashCommand);
71
+ const command = this.commands.get(interaction.commandName, builders_1.CommandType.SlashCommand);
72
72
  if (!command)
73
73
  return;
74
74
  const executeData = {
@@ -97,7 +97,7 @@ class RecipleClient extends discord_js_1.Client {
97
97
  command: command.name,
98
98
  channel: interaction.channel ?? undefined,
99
99
  guild: interaction.guild,
100
- type: builders_1.CommandBuilderType.SlashCommand,
100
+ type: builders_1.CommandType.SlashCommand,
101
101
  };
102
102
  if (this.config.commands.slashCommand.enableCooldown && command.cooldown && !this.cooldowns.isCooledDown(userCooldown)) {
103
103
  this.cooldowns.add({
@@ -135,7 +135,7 @@ class RecipleClient extends discord_js_1.Client {
135
135
  const parseCommand = (0, fallout_utility_1.getCommand)(message.content, prefix || this.config.commands.messageCommand.prefix || '!', this.config.commands.messageCommand.commandArgumentSeparator || ' ');
136
136
  if (!parseCommand || !parseCommand?.command)
137
137
  return;
138
- const command = this.commands.get(parseCommand.command, builders_1.CommandBuilderType.MessageCommand);
138
+ const command = this.commands.get(parseCommand.command, builders_1.CommandType.MessageCommand);
139
139
  if (!command)
140
140
  return;
141
141
  const commandOptions = await (0, MessageCommandBuilder_1.validateMessageCommandOptions)(command, parseCommand);
@@ -189,7 +189,7 @@ class RecipleClient extends discord_js_1.Client {
189
189
  command: command.name,
190
190
  channel: message.channel,
191
191
  guild: message.guild,
192
- type: builders_1.CommandBuilderType.MessageCommand,
192
+ type: builders_1.CommandType.MessageCommand,
193
193
  };
194
194
  if (this.config.commands.messageCommand.enableCooldown && command.cooldown && !this.cooldowns.isCooledDown(userCooldown)) {
195
195
  this.cooldowns.add({
@@ -234,7 +234,7 @@ class RecipleClient extends discord_js_1.Client {
234
234
  async _haltCommand(command, haltData) {
235
235
  try {
236
236
  const haltResolved = (command.halt
237
- ? await Promise.resolve(command.type == builders_1.CommandBuilderType.SlashCommand ? command.halt(haltData) : command.halt(haltData)).catch(err => {
237
+ ? await Promise.resolve(command.type == builders_1.CommandType.SlashCommand ? command.halt(haltData) : command.halt(haltData)).catch(err => {
238
238
  console.log(err);
239
239
  })
240
240
  : false) || false;
@@ -251,7 +251,7 @@ class RecipleClient extends discord_js_1.Client {
251
251
  }
252
252
  async _executeCommand(command, executeData) {
253
253
  try {
254
- await Promise.resolve(command.type === builders_1.CommandBuilderType.SlashCommand ? command.execute(executeData) : command.execute(executeData))
254
+ await Promise.resolve(command.type === builders_1.CommandType.SlashCommand ? command.execute(executeData) : command.execute(executeData))
255
255
  .then(() => this.emit('recipleCommandExecute', executeData))
256
256
  .catch(async (err) => !(await this._haltCommand(command, {
257
257
  executeData: executeData,
@@ -279,7 +279,7 @@ class RecipleClient extends discord_js_1.Client {
279
279
  */
280
280
  async _commandExecuteError(err, command) {
281
281
  if (!this.isClientLogsSilent) {
282
- this.logger.error(`An error occured executing ${command.builder.type == builders_1.CommandBuilderType.MessageCommand ? 'message' : 'slash'} command "${command.builder.name}"`);
282
+ this.logger.error(`An error occured executing ${command.builder.type == builders_1.CommandType.MessageCommand ? 'message' : 'slash'} command "${command.builder.name}"`);
283
283
  this.logger.error(err);
284
284
  }
285
285
  if (!err || !command)
@@ -34,14 +34,14 @@ class RecipleModule {
34
34
  }
35
35
  async registerSlashCommands(...guilds) {
36
36
  for (const command of this.commands.toJSON()) {
37
- if (command.type !== builders_1.CommandBuilderType.SlashCommand)
37
+ if (command.type !== builders_1.CommandType.SlashCommand)
38
38
  continue;
39
39
  await this.client.applicationCommands.add(command, (0, discord_js_1.normalizeArray)(guilds));
40
40
  }
41
41
  }
42
42
  async unregisterSlashCommands(...guilds) {
43
43
  for (const builder of this.commands.toJSON()) {
44
- if (builder.type !== builders_1.CommandBuilderType.SlashCommand)
44
+ if (builder.type !== builders_1.CommandType.SlashCommand)
45
45
  continue;
46
46
  if ((0, discord_js_1.normalizeArray)(guilds).length) {
47
47
  for (const guild of (0, discord_js_1.normalizeArray)(guilds)) {
@@ -58,7 +58,7 @@ class RecipleModule {
58
58
  }
59
59
  async updateSlashCommands(...guilds) {
60
60
  for (const builder of this.commands.toJSON()) {
61
- if (builder.type !== builders_1.CommandBuilderType.SlashCommand)
61
+ if (builder.type !== builders_1.CommandType.SlashCommand)
62
62
  continue;
63
63
  if ((0, discord_js_1.normalizeArray)(guilds).length) {
64
64
  for (const guild of (0, discord_js_1.normalizeArray)(guilds)) {
@@ -77,9 +77,9 @@ class RecipleModule {
77
77
  if (!Array.isArray(this.script?.commands))
78
78
  return this.commands;
79
79
  for (const command of this.script.commands) {
80
- if (command?.type !== builders_1.CommandBuilderType.SlashCommand && command?.type !== builders_1.CommandBuilderType.MessageCommand)
80
+ if (command?.type !== builders_1.CommandType.SlashCommand && command?.type !== builders_1.CommandType.MessageCommand)
81
81
  continue;
82
- const builder = command.type === builders_1.CommandBuilderType.SlashCommand ? SlashCommandBuilder_1.SlashCommandBuilder.resolveSlashCommand(command) : MessageCommandBuilder_1.MessageCommandBuilder.resolveMessageCommand(command);
82
+ const builder = command.type === builders_1.CommandType.SlashCommand ? SlashCommandBuilder_1.SlashCommandBuilder.resolveSlashCommand(command) : MessageCommandBuilder_1.MessageCommandBuilder.resolveMessageCommand(command);
83
83
  if (!(0, util_1.validateCommandBuilder)(builder))
84
84
  throw new Error('Invalid command builder, no name or contains option(s) without name');
85
85
  this.commands.set(command.name, builder);
@@ -10,7 +10,7 @@ const MessageCommandOptionBuilder_1 = require("./MessageCommandOptionBuilder");
10
10
  */
11
11
  class MessageCommandBuilder {
12
12
  constructor(data) {
13
- this.type = builders_1.CommandBuilderType.MessageCommand;
13
+ this.type = builders_1.CommandType.MessageCommand;
14
14
  this.name = '';
15
15
  this.description = '';
16
16
  this.cooldown = 0;
@@ -10,7 +10,7 @@ const discord_js_1 = require("discord.js");
10
10
  class SlashCommandBuilder extends discord_js_1.SlashCommandBuilder {
11
11
  constructor(data) {
12
12
  super();
13
- this.type = builders_1.CommandBuilderType.SlashCommand;
13
+ this.type = builders_1.CommandType.SlashCommand;
14
14
  this.cooldown = 0;
15
15
  this.requiredBotPermissions = [];
16
16
  this.requiredMemberPermissions = [];
@@ -182,10 +182,7 @@ class SlashCommandBuilder extends discord_js_1.SlashCommandBuilder {
182
182
  default:
183
183
  throw new TypeError('Unknown option data');
184
184
  }
185
- if (!(builder instanceof discord_js_1.SlashCommandSubcommandBuilder) &&
186
- !(builder instanceof discord_js_1.SlashCommandSubcommandGroupBuilder) &&
187
- option.type !== discord_js_1.ApplicationCommandOptionType.Subcommand &&
188
- option.type !== discord_js_1.ApplicationCommandOptionType.SubcommandGroup) {
185
+ if (!(builder instanceof discord_js_1.SlashCommandSubcommandBuilder) && !(builder instanceof discord_js_1.SlashCommandSubcommandGroupBuilder) && option.type !== discord_js_1.ApplicationCommandOptionType.Subcommand && option.type !== discord_js_1.ApplicationCommandOptionType.SubcommandGroup) {
189
186
  builder.setRequired(option.required ?? false);
190
187
  }
191
188
  return builder
@@ -109,7 +109,7 @@ class ApplicationCommandManager {
109
109
  const commands = guild ? this.client.guilds.resolve(guild)?.commands.cache : this.client.application?.commands.cache;
110
110
  if (!commands)
111
111
  throw new Error('Guild not found in cache');
112
- return commands.find(cmd => typeof command === 'string' ? cmd.id === command || cmd.name === command : cmd.name === command.name || (command instanceof discord_js_1.ApplicationCommand && cmd.id === command.id));
112
+ return commands.find(cmd => (typeof command === 'string' ? cmd.id === command || cmd.name === command : cmd.name === command.name || (command instanceof discord_js_1.ApplicationCommand && cmd.id === command.id)));
113
113
  }
114
114
  async fetch(commandId, guild) {
115
115
  const manager = guild ? this.client.guilds.resolve(guild)?.commands : this.client.application?.commands;
@@ -122,9 +122,7 @@ class ApplicationCommandManager {
122
122
  if (cmd?.toJSON === undefined)
123
123
  return cmd;
124
124
  if (SlashCommandBuilder_1.SlashCommandBuilder.isSlashCommandBuilder(cmd) && this.client.config.commands.slashCommand.setRequiredPermissions) {
125
- const permissions = setPermissions || this.client.config.commands.slashCommand.permissions.enabled
126
- ? this.client.config.commands.slashCommand.permissions.commands.find(cmd_ => cmd_.command.toLowerCase() === cmd.name.toLowerCase())?.permissions
127
- : undefined;
125
+ const permissions = setPermissions || this.client.config.commands.slashCommand.permissions.enabled ? this.client.config.commands.slashCommand.permissions.commands.find(cmd_ => cmd_.command.toLowerCase() === cmd.name.toLowerCase())?.permissions : undefined;
128
126
  if (permissions) {
129
127
  cmd.setRequiredMemberPermissions(...permissions);
130
128
  if (!this.client.isClientLogsSilent)
@@ -23,10 +23,10 @@ class ClientCommandManager {
23
23
  */
24
24
  add(...commands) {
25
25
  for (const command of (0, discord_js_1.normalizeArray)(commands)) {
26
- if (command.type === builders_1.CommandBuilderType.SlashCommand) {
26
+ if (command.type === builders_1.CommandType.SlashCommand) {
27
27
  this.slashCommands.set(command.name, SlashCommandBuilder_1.SlashCommandBuilder.resolveSlashCommand(command));
28
28
  }
29
- else if (command.type === builders_1.CommandBuilderType.MessageCommand) {
29
+ else if (command.type === builders_1.CommandType.MessageCommand) {
30
30
  this.messageCommands.set(command.name, MessageCommandBuilder_1.MessageCommandBuilder.resolveMessageCommand(command));
31
31
  }
32
32
  else {
@@ -37,11 +37,10 @@ class ClientCommandManager {
37
37
  }
38
38
  get(command, type) {
39
39
  switch (type) {
40
- case builders_1.CommandBuilderType.SlashCommand:
40
+ case builders_1.CommandType.SlashCommand:
41
41
  return this.slashCommands.get(command);
42
- case builders_1.CommandBuilderType.MessageCommand:
43
- return (this.messageCommands.get(command.toLowerCase()) ??
44
- (this.client.config.commands.messageCommand.allowCommandAlias ? this.messageCommands.find(c => c.aliases.some(a => a == command?.toLowerCase())) : undefined));
42
+ case builders_1.CommandType.MessageCommand:
43
+ return this.messageCommands.get(command.toLowerCase()) ?? (this.client.config.commands.messageCommand.allowCommandAlias ? this.messageCommands.find(c => c.aliases.some(a => a == command?.toLowerCase())) : undefined);
45
44
  default:
46
45
  throw new TypeError('Unknown command type');
47
46
  }
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CommandBuilderType = void 0;
3
+ exports.CommandType = void 0;
4
4
  /**
5
5
  * Types of command builders
6
6
  */
7
- var CommandBuilderType;
8
- (function (CommandBuilderType) {
9
- CommandBuilderType[CommandBuilderType["MessageCommand"] = 0] = "MessageCommand";
10
- CommandBuilderType[CommandBuilderType["SlashCommand"] = 1] = "SlashCommand";
11
- })(CommandBuilderType = exports.CommandBuilderType || (exports.CommandBuilderType = {}));
7
+ var CommandType;
8
+ (function (CommandType) {
9
+ CommandType[CommandType["MessageCommand"] = 0] = "MessageCommand";
10
+ CommandType[CommandType["SlashCommand"] = 1] = "SlashCommand";
11
+ })(CommandType = exports.CommandType || (exports.CommandType = {}));
@@ -31,7 +31,7 @@ exports.deprecationWarning = deprecationWarning;
31
31
  function validateCommandBuilder(command) {
32
32
  if (!command.name)
33
33
  return false;
34
- if (command.type === builders_1.CommandBuilderType.MessageCommand && command.options.length && command.options.some(o => !o.name))
34
+ if (command.type === builders_1.CommandType.MessageCommand && command.options.length && command.options.some(o => !o.name))
35
35
  return false;
36
36
  return true;
37
37
  }
@@ -2,9 +2,9 @@ export * from './reciple/classes/builders/MessageCommandBuilder';
2
2
  export * from './reciple/classes/builders/MessageCommandOptionBuilder';
3
3
  export * from './reciple/classes/builders/SlashCommandBuilder';
4
4
  export * from './reciple/classes/managers/ApplicationCommandManager';
5
- export * from './reciple/classes/managers/CommandCooldownManager';
6
5
  export * from './reciple/classes/managers/ClientCommandManager';
7
6
  export * from './reciple/classes/managers/ClientModuleManager';
7
+ export * from './reciple/classes/managers/CommandCooldownManager';
8
8
  export * from './reciple/classes/managers/MessageCommandOptionManager';
9
9
  export * from './reciple/classes/RecipleClient';
10
10
  export * from './reciple/classes/RecipleConfig';
@@ -1,4 +1,4 @@
1
- import { CommandBuilderType, CommandHaltFunction, CommandExecuteFunction, SharedCommandBuilderProperties, MessageCommandData } from '../../types/builders';
1
+ import { CommandType, CommandHaltFunction, CommandExecuteFunction, SharedCommandBuilderProperties, MessageCommandData } from '../../types/builders';
2
2
  import { Message, PermissionResolvable, RestOrArray } from 'discord.js';
3
3
  import { BaseCommandExecuteData, CommandHaltData } from '../../types/commands';
4
4
  import { MessageCommandOptionManager } from '../managers/MessageCommandOptionManager';
@@ -53,20 +53,20 @@ export interface MessageCommandValidatedOption {
53
53
  /**
54
54
  * Halt data for message command
55
55
  */
56
- export declare type MessageCommandHaltData<T = unknown> = CommandHaltData<CommandBuilderType.MessageCommand, T>;
56
+ export declare type MessageCommandHaltData<T = unknown> = CommandHaltData<CommandType.MessageCommand, T>;
57
57
  /**
58
58
  * Message command halt function
59
59
  */
60
- export declare type MessageCommandHaltFunction<T = unknown> = CommandHaltFunction<CommandBuilderType.MessageCommand, T>;
60
+ export declare type MessageCommandHaltFunction<T = unknown> = CommandHaltFunction<CommandType.MessageCommand, T>;
61
61
  /**
62
62
  * Message command execute function
63
63
  */
64
- export declare type MessageCommandExecuteFunction<T = unknown> = CommandExecuteFunction<CommandBuilderType.MessageCommand, T>;
64
+ export declare type MessageCommandExecuteFunction<T = unknown> = CommandExecuteFunction<CommandType.MessageCommand, T>;
65
65
  /**
66
66
  * Reciple builder for message command
67
67
  */
68
68
  export declare class MessageCommandBuilder<T = unknown> implements SharedCommandBuilderProperties<T> {
69
- readonly type = CommandBuilderType.MessageCommand;
69
+ readonly type = CommandType.MessageCommand;
70
70
  name: string;
71
71
  description: string;
72
72
  cooldown: number;
@@ -1,4 +1,4 @@
1
- import { CommandBuilderType, CommandHaltFunction, CommandExecuteFunction, SharedCommandBuilderProperties, AnySlashCommandBuilder, SlashCommandData, AnySlashCommandOptionData, AnySlashCommandOptionBuilder } from '../../types/builders';
1
+ import { CommandType, CommandHaltFunction, CommandExecuteFunction, SharedCommandBuilderProperties, AnySlashCommandBuilder, SlashCommandData, AnySlashCommandOptionData, AnySlashCommandOptionBuilder } from '../../types/builders';
2
2
  import { BaseCommandExecuteData, CommandHaltData } from '../../types/commands';
3
3
  import { ChatInputCommandInteraction, PermissionResolvable, RestOrArray, SlashCommandBuilder as DiscordJsSlashCommandBuilder, SlashCommandSubcommandBuilder, SlashCommandSubcommandGroupBuilder, SlashCommandBooleanOption, SlashCommandUserOption, SlashCommandChannelOption, SlashCommandRoleOption, SlashCommandAttachmentOption, SlashCommandMentionableOption, SlashCommandStringOption, SlashCommandIntegerOption, SlashCommandNumberOption, SharedSlashCommandOptions } from 'discord.js';
4
4
  /**
@@ -17,15 +17,15 @@ export interface SlashCommandExecuteData<T = unknown> extends BaseCommandExecute
17
17
  /**
18
18
  * Slash command halt data
19
19
  */
20
- export declare type SlashCommandHaltData<T = unknown> = CommandHaltData<CommandBuilderType.SlashCommand, T>;
20
+ export declare type SlashCommandHaltData<T = unknown> = CommandHaltData<CommandType.SlashCommand, T>;
21
21
  /**
22
22
  * Slash command halt function
23
23
  */
24
- export declare type SlashCommandHaltFunction<T = unknown> = CommandHaltFunction<CommandBuilderType.SlashCommand, T>;
24
+ export declare type SlashCommandHaltFunction<T = unknown> = CommandHaltFunction<CommandType.SlashCommand, T>;
25
25
  /**
26
26
  * Slash command execute function
27
27
  */
28
- export declare type SlashCommandExecuteFunction<T = unknown> = CommandExecuteFunction<CommandBuilderType.SlashCommand, T>;
28
+ export declare type SlashCommandExecuteFunction<T = unknown> = CommandExecuteFunction<CommandType.SlashCommand, T>;
29
29
  export declare type SlashCommandSubcommandsOnlyBuilder<T = unknown> = Omit<SlashCommandBuilder<T>, 'addBooleanOption' | 'addUserOption' | 'addChannelOption' | 'addRoleOption' | 'addAttachmentOption' | 'addMentionableOption' | 'addStringOption' | 'addIntegerOption' | 'addNumberOption'>;
30
30
  export declare type SlashCommandOptionsOnlyBuilder<T = unknown> = Omit<SlashCommandBuilder<T>, 'addSubcommand' | 'addSubcommandGroup'>;
31
31
  export interface SlashCommandBuilder<T = unknown> extends DiscordJsSlashCommandBuilder {
@@ -45,7 +45,7 @@ export interface SlashCommandBuilder<T = unknown> extends DiscordJsSlashCommandB
45
45
  * Reciple builder for slash command
46
46
  */
47
47
  export declare class SlashCommandBuilder<T = unknown> extends DiscordJsSlashCommandBuilder implements SharedCommandBuilderProperties<T> {
48
- readonly type = CommandBuilderType.SlashCommand;
48
+ readonly type = CommandType.SlashCommand;
49
49
  cooldown: number;
50
50
  requiredBotPermissions: PermissionResolvable[];
51
51
  requiredMemberPermissions: PermissionResolvable[];
@@ -1,5 +1,5 @@
1
1
  import { ApplicationCommandData, Collection, GuildResolvable, RestOrArray } from 'discord.js';
2
- import { AnyCommandBuilder, AnyCommandData, AnySlashCommandBuilder, CommandBuilderType, MessageCommandData, SlashCommandData } from '../../types/builders';
2
+ import { AnyCommandBuilder, AnyCommandData, AnySlashCommandBuilder, CommandType, MessageCommandData, SlashCommandData } from '../../types/builders';
3
3
  import { MessageCommandBuilder } from '../builders/MessageCommandBuilder';
4
4
  import { SlashCommandBuilder } from '../builders/SlashCommandBuilder';
5
5
  import { RecipleClient } from '../RecipleClient';
@@ -27,8 +27,8 @@ export declare class ClientCommandManager {
27
27
  * @param type Command type
28
28
  */
29
29
  get(command: string, type?: undefined): AnyCommandBuilder | undefined;
30
- get(command: string, type?: CommandBuilderType.MessageCommand): MessageCommandBuilder | undefined;
31
- get(command: string, type?: CommandBuilderType.SlashCommand): SlashCommandBuilder | undefined;
30
+ get(command: string, type?: CommandType.MessageCommand): MessageCommandBuilder | undefined;
31
+ get(command: string, type?: CommandType.SlashCommand): SlashCommandBuilder | undefined;
32
32
  /**
33
33
  * Register application commands
34
34
  * @param guilds Register application commands to guilds
@@ -1,5 +1,5 @@
1
1
  import { Guild, RestOrArray, TextBasedChannel, User } from 'discord.js';
2
- import { CommandBuilderType } from '../../types/builders';
2
+ import { CommandType } from '../../types/builders';
3
3
  /**
4
4
  * cooled-down user object interface
5
5
  */
@@ -15,7 +15,7 @@ export interface CooledDownUser {
15
15
  /**
16
16
  * Command type
17
17
  */
18
- type: CommandBuilderType;
18
+ type: CommandType;
19
19
  /**
20
20
  * In guild
21
21
  */
@@ -25,11 +25,11 @@ export declare type AnyCommandExecuteFunction<T = unknown> = SlashCommandExecute
25
25
  /**
26
26
  * Command halt function
27
27
  */
28
- export declare type CommandHaltFunction<T extends CommandBuilderType, M = unknown> = (haltData: T extends CommandBuilderType.SlashCommand ? SlashCommandHaltData<M> : T extends CommandBuilderType.MessageCommand ? MessageCommandHaltData<M> : SlashCommandHaltData<M> | MessageCommandHaltData<M>) => Awaitable<boolean | null | undefined | void>;
28
+ export declare type CommandHaltFunction<T extends CommandType, M = unknown> = (haltData: T extends CommandType.SlashCommand ? SlashCommandHaltData<M> : T extends CommandType.MessageCommand ? MessageCommandHaltData<M> : SlashCommandHaltData<M> | MessageCommandHaltData<M>) => Awaitable<boolean | null | undefined | void>;
29
29
  /**
30
30
  * Command execute function
31
31
  */
32
- export declare type CommandExecuteFunction<T extends CommandBuilderType, M = unknown> = (executeData: T extends CommandBuilderType.SlashCommand ? SlashCommandExecuteData<M> : T extends CommandBuilderType.MessageCommand ? MessageCommandExecuteData<M> : SlashCommandExecuteData<M> | MessageCommandExecuteData<M>) => Awaitable<void>;
32
+ export declare type CommandExecuteFunction<T extends CommandType, M = unknown> = (executeData: T extends CommandType.SlashCommand ? SlashCommandExecuteData<M> : T extends CommandType.MessageCommand ? MessageCommandExecuteData<M> : SlashCommandExecuteData<M> | MessageCommandExecuteData<M>) => Awaitable<void>;
33
33
  /**
34
34
  * Message command options resolvable
35
35
  */
@@ -53,7 +53,7 @@ export declare type AnySlashCommandOptionsOnlyOptionBuilder = SlashCommandAttach
53
53
  /**
54
54
  * Types of command builders
55
55
  */
56
- export declare enum CommandBuilderType {
56
+ export declare enum CommandType {
57
57
  MessageCommand = 0,
58
58
  SlashCommand = 1
59
59
  }
@@ -61,7 +61,7 @@ export declare enum CommandBuilderType {
61
61
  * Shared command builder methods and properties
62
62
  */
63
63
  export interface SharedCommandBuilderProperties<T = unknown> {
64
- readonly type: CommandBuilderType;
64
+ readonly type: CommandType;
65
65
  cooldown: number;
66
66
  requiredBotPermissions: PermissionResolvable[];
67
67
  requiredMemberPermissions: PermissionResolvable[];
@@ -111,7 +111,7 @@ export interface SharedCommandDataProperties {
111
111
  * Slash command object data interface
112
112
  */
113
113
  export interface SlashCommandData<T = unknown> extends SharedCommandDataProperties, Partial<Omit<SharedCommandBuilderProperties<T>, 'setCooldown' | 'setRequiredBotPermissions' | 'setRequiredMemberPermissions' | 'setHalt' | 'setExecute' | 'setMetadata' | 'halt' | 'execute'>> {
114
- type: CommandBuilderType.SlashCommand;
114
+ type: CommandType.SlashCommand;
115
115
  nameLocalizations?: LocalizationMap;
116
116
  descriptionLocalizations?: LocalizationMap;
117
117
  options?: (AnySlashCommandOptionData | AnySlashCommandOptionBuilder)[];
@@ -179,7 +179,7 @@ export interface SlashCommandSubCommandGroupData extends SharedCommandDataProper
179
179
  * Message command object data interface
180
180
  */
181
181
  export interface MessageCommandData<T = unknown> extends SharedCommandDataProperties, Partial<Omit<SharedCommandBuilderProperties<T>, 'setCooldown' | 'setRequiredBotPermissions' | 'setRequiredMemberPermissions' | 'setHalt' | 'setExecute' | 'setMetadata' | 'halt' | 'execute'>> {
182
- type: CommandBuilderType.MessageCommand;
182
+ type: CommandType.MessageCommand;
183
183
  aliases?: string[];
184
184
  validateOptions?: boolean;
185
185
  allowExecuteInDM?: boolean;
@@ -3,7 +3,7 @@ import { SlashCommandExecuteData, SlashCommandHaltData } from '../classes/builde
3
3
  import { MessageCommandOptionManager } from '../classes/managers/MessageCommandOptionManager';
4
4
  import { CooledDownUser } from '../classes/managers/CommandCooldownManager';
5
5
  import { RecipleClient } from '../classes/RecipleClient';
6
- import { CommandBuilderType } from '../types/builders';
6
+ import { CommandType } from '../types/builders';
7
7
  /**
8
8
  * Any command halt data
9
9
  */
@@ -11,7 +11,7 @@ export declare type AnyCommandHaltData<T = unknown> = SlashCommandHaltData<T> |
11
11
  /**
12
12
  * command halt data
13
13
  */
14
- export declare type CommandHaltData<T extends CommandBuilderType, M = unknown> = CommandErrorData<T, M> | CommandCooldownData<T, M> | (T extends CommandBuilderType.SlashCommand ? never : CommandInvalidArguments<T, M> | CommandMissingArguments<T, M>) | CommandMissingMemberPermissions<T, M> | CommandMissingBotPermissions<T, M>;
14
+ export declare type CommandHaltData<T extends CommandType, M = unknown> = CommandErrorData<T, M> | CommandCooldownData<T, M> | (T extends CommandType.SlashCommand ? never : CommandInvalidArguments<T, M> | CommandMissingArguments<T, M>) | CommandMissingMemberPermissions<T, M> | CommandMissingBotPermissions<T, M>;
15
15
  /**
16
16
  * Any command execute data
17
17
  */
@@ -28,7 +28,7 @@ export interface BaseCommandExecuteData {
28
28
  /**
29
29
  * Command halt reason base
30
30
  */
31
- export interface BaseCommandHaltData<T extends CommandBuilderType, M = unknown> {
31
+ export interface BaseCommandHaltData<T extends CommandType, M = unknown> {
32
32
  /**
33
33
  * Halt reason
34
34
  */
@@ -36,36 +36,36 @@ export interface BaseCommandHaltData<T extends CommandBuilderType, M = unknown>
36
36
  /**
37
37
  * Command execute da6a
38
38
  */
39
- executeData: T extends CommandBuilderType.SlashCommand ? SlashCommandExecuteData<M> : T extends CommandBuilderType.MessageCommand ? MessageCommandExecuteData<M> : AnyCommandExecuteData<M>;
39
+ executeData: T extends CommandType.SlashCommand ? SlashCommandExecuteData<M> : T extends CommandType.MessageCommand ? MessageCommandExecuteData<M> : AnyCommandExecuteData<M>;
40
40
  }
41
- export interface CommandErrorData<T extends CommandBuilderType, M = unknown> extends BaseCommandHaltData<T, M> {
41
+ export interface CommandErrorData<T extends CommandType, M = unknown> extends BaseCommandHaltData<T, M> {
42
42
  reason: CommandHaltReason.Error;
43
43
  /**
44
44
  * Caught error
45
45
  */
46
46
  error: any;
47
47
  }
48
- export interface CommandCooldownData<T extends CommandBuilderType, M = unknown> extends BaseCommandHaltData<T, M>, CooledDownUser {
48
+ export interface CommandCooldownData<T extends CommandType, M = unknown> extends BaseCommandHaltData<T, M>, CooledDownUser {
49
49
  reason: CommandHaltReason.Cooldown;
50
50
  }
51
- export interface CommandInvalidArguments<T extends CommandBuilderType, M = unknown> extends BaseCommandHaltData<T, M> {
51
+ export interface CommandInvalidArguments<T extends CommandType, M = unknown> extends BaseCommandHaltData<T, M> {
52
52
  reason: CommandHaltReason.InvalidArguments;
53
53
  /**
54
54
  * Arguments that are invalid
55
55
  */
56
56
  invalidArguments: MessageCommandOptionManager;
57
57
  }
58
- export interface CommandMissingArguments<T extends CommandBuilderType, M = unknown> extends BaseCommandHaltData<T, M> {
58
+ export interface CommandMissingArguments<T extends CommandType, M = unknown> extends BaseCommandHaltData<T, M> {
59
59
  reason: CommandHaltReason.MissingArguments;
60
60
  /**
61
61
  * Arguments that are missing
62
62
  */
63
63
  missingArguments: MessageCommandOptionManager;
64
64
  }
65
- export interface CommandMissingMemberPermissions<T extends CommandBuilderType, M = unknown> extends BaseCommandHaltData<T, M> {
65
+ export interface CommandMissingMemberPermissions<T extends CommandType, M = unknown> extends BaseCommandHaltData<T, M> {
66
66
  reason: CommandHaltReason.MissingMemberPermissions;
67
67
  }
68
- export interface CommandMissingBotPermissions<T extends CommandBuilderType, M = unknown> extends BaseCommandHaltData<T, M> {
68
+ export interface CommandMissingBotPermissions<T extends CommandType, M = unknown> extends BaseCommandHaltData<T, M> {
69
69
  reason: CommandHaltReason.MissingBotPermissions;
70
70
  }
71
71
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reciple",
3
- "version": "6.0.0-dev.8",
3
+ "version": "6.0.0-dev.9",
4
4
  "bin": "./dist/cjs/bin.js",
5
5
  "license": "GPL-3.0",
6
6
  "main": "./dist/cjs/index.js",
@@ -26,14 +26,15 @@
26
26
  "url": "https://github.com/FalloutStudios/reciple/issues"
27
27
  },
28
28
  "scripts": {
29
- "format": "yarn prettier --write src",
30
- "clean": "yarn exec rimraf dist",
31
- "build": "yarn clean && yarn exec tsc",
32
- "build:publish": "yarn format && yarn build && yarn docs && yarn npm publish",
33
- "build:publish-dev": "yarn format && yarn build && yarn npm publish --tag dev",
34
- "test": "yarn build && yarn workspace test start",
35
- "docs": "yarn exec docgen --typescript true -c ./docs/index.json -o ./docs/docs.json -i src/index.ts",
36
- "watch": "yarn exec tsc --watch --noEmit"
29
+ "format": "npx prettier --write src",
30
+ "clean": "npx rimraf dist",
31
+ "build": "npm run clean && npx tsc",
32
+ "build:publish": "npm run format && npm run build && npx docs && npm publish",
33
+ "build:publish-dev": "npm run format && npm run build && npm publish --tag dev",
34
+ "test": "npm run build && npm run start -w test",
35
+ "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"
37
38
  },
38
39
  "repository": {
39
40
  "type": "git",
@@ -63,6 +64,7 @@
63
64
  "@types/node": "^18.11.0",
64
65
  "@types/semver": "^7.3.12",
65
66
  "discord.js": "^14.6.0",
67
+ "husky": "^8.0.1",
66
68
  "prettier": "2.7.1",
67
69
  "rimraf": "^3.0.2",
68
70
  "typescript": "^4.8.4"
@@ -72,6 +74,5 @@
72
74
  },
73
75
  "workspaces": [
74
76
  "test"
75
- ],
76
- "packageManager": "yarn@3.2.2"
77
- }
77
+ ]
78
+ }
package/docs/README.md DELETED
@@ -1 +0,0 @@
1
- # [VIEW DOCS](https://reciple.js.org/#/docs)