reciple 1.0.0 → 1.0.1

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.
@@ -12,8 +12,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.RecipleClient = void 0;
13
13
  const discord_js_1 = require("discord.js");
14
14
  const fallout_utility_1 = require("fallout-utility");
15
- const MessageCommandBuilder_1 = require("./builders/MessageCommandBuilder");
16
- const InteractionCommandBuilder_1 = require("./builders/InteractionCommandBuilder");
17
15
  const registerInteractionCommands_1 = require("../registerInteractionCommands");
18
16
  const logger_1 = require("../logger");
19
17
  const modules_1 = require("../modules");
@@ -43,10 +41,10 @@ class RecipleClient extends discord_js_1.Client {
43
41
  for (const command of modules.commands) {
44
42
  if (!command.name)
45
43
  continue;
46
- if (command instanceof MessageCommandBuilder_1.MessageCommandBuilder) {
44
+ if (command.type === 'MESSAGE_COMMAND') {
47
45
  this.commands.MESSAGE_COMMANDS[command.name] = command;
48
46
  }
49
- else if (command instanceof InteractionCommandBuilder_1.InteractionCommandBuilder) {
47
+ else if (command.type === 'INTERACTION_COMMAND') {
50
48
  this.commands.INTERACTION_COMMANDS[command.name] = command;
51
49
  }
52
50
  }
@@ -8,6 +8,7 @@ export interface RecipleInteractionCommandExecute {
8
8
  client: RecipleClient;
9
9
  }
10
10
  export declare class InteractionCommandBuilder extends SlashCommandBuilder {
11
+ readonly type: string;
11
12
  allowExecuteInDM: boolean;
12
13
  execute: (options: RecipleInteractionCommandExecute) => void;
13
14
  setAllowExecuteInDM(allowExecuteInDM: boolean): InteractionCommandBuilder;
@@ -5,6 +5,7 @@ const builders_1 = require("@discordjs/builders");
5
5
  class InteractionCommandBuilder extends builders_1.SlashCommandBuilder {
6
6
  constructor() {
7
7
  super(...arguments);
8
+ this.type = 'INTERACTION_COMMAND';
8
9
  this.allowExecuteInDM = true;
9
10
  this.execute = (options) => { };
10
11
  }
@@ -29,6 +29,7 @@ export declare class MessageOption {
29
29
  setValidator(validator: (value: any) => boolean): MessageOption;
30
30
  }
31
31
  export declare class MessageCommandBuilder {
32
+ readonly type: string;
32
33
  name: string;
33
34
  description: string;
34
35
  options: MessageOption[];
@@ -36,6 +36,7 @@ class MessageOption {
36
36
  exports.MessageOption = MessageOption;
37
37
  class MessageCommandBuilder {
38
38
  constructor() {
39
+ this.type = 'MESSAGE_COMMAND';
39
40
  this.name = '';
40
41
  this.description = '';
41
42
  this.options = [];
@@ -15,7 +15,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.loadModules = void 0;
16
16
  const fs_1 = require("fs");
17
17
  const MessageCommandBuilder_1 = require("./classes/builders/MessageCommandBuilder");
18
- const InteractionCommandBuilder_1 = require("./classes/builders/InteractionCommandBuilder");
19
18
  const path_1 = __importDefault(require("path"));
20
19
  function loadModules(client) {
21
20
  var _a;
@@ -38,10 +37,8 @@ function loadModules(client) {
38
37
  throw new Error(script + ' onStart is not defined or returned false.');
39
38
  if (module_.commands) {
40
39
  for (const command of module_.commands) {
41
- if (!(command instanceof MessageCommandBuilder_1.MessageCommandBuilder) && !(command instanceof InteractionCommandBuilder_1.InteractionCommandBuilder)) {
42
- continue;
43
- }
44
- commands.push(command);
40
+ if (command.type === 'MESSAGE_COMMAND' || command.type === 'INTERACTION_COMMAND')
41
+ commands.push(command);
45
42
  }
46
43
  }
47
44
  }
@@ -55,7 +52,7 @@ function loadModules(client) {
55
52
  logger.error(`A message command name is not defined in ${script}`);
56
53
  return false;
57
54
  }
58
- if (c instanceof MessageCommandBuilder_1.MessageCommandBuilder && c.options.some(o => !o.name)) {
55
+ if (c instanceof MessageCommandBuilder_1.MessageCommandBuilder && c.options.length && c.options.some(o => !o.name)) {
59
56
  logger.error(`A message command option name is not defined in ${script}`);
60
57
  return false;
61
58
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reciple",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "A Discord.js bot",
5
5
  "author": "FalloutStudios",
6
6
  "license": "GPL-3.0",