reciple 1.0.10 → 1.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/index.d.ts CHANGED
@@ -4,6 +4,7 @@ export * from './reciple/classes/builders/MessageCommandBuilder';
4
4
  export * from './reciple/classes/builders/InteractionCommandBuilder';
5
5
  export * from './reciple/commandPermissions';
6
6
  export * from './reciple/flags';
7
+ export * from './reciple/isIgnoredChannel';
7
8
  export * from './reciple/logger';
8
9
  export * from './reciple/modules';
9
10
  export * from './reciple/registerInteractionCommands';
package/bin/index.js CHANGED
@@ -20,6 +20,7 @@ __exportStar(require("./reciple/classes/builders/MessageCommandBuilder"), export
20
20
  __exportStar(require("./reciple/classes/builders/InteractionCommandBuilder"), exports);
21
21
  __exportStar(require("./reciple/commandPermissions"), exports);
22
22
  __exportStar(require("./reciple/flags"), exports);
23
+ __exportStar(require("./reciple/isIgnoredChannel"), exports);
23
24
  __exportStar(require("./reciple/logger"), exports);
24
25
  __exportStar(require("./reciple/modules"), exports);
25
26
  __exportStar(require("./reciple/registerInteractionCommands"), exports);
@@ -76,14 +76,14 @@ class RecipleClient extends discord_js_1.Client {
76
76
  return this;
77
77
  }
78
78
  messageCommandExecute(message) {
79
- var _a, _b, _c, _d, _e, _f, _g;
79
+ var _a, _b, _c, _d, _e, _f, _g, _h;
80
80
  return __awaiter(this, void 0, void 0, function* () {
81
81
  if (!message.content || !((_a = this.config) === null || _a === void 0 ? void 0 : _a.commands.messageCommand.enabled))
82
82
  return this;
83
83
  const parseCommand = (0, fallout_utility_1.getCommand)(message.content, ((_b = this.config) === null || _b === void 0 ? void 0 : _b.prefix) || '!', ((_c = this.config) === null || _c === void 0 ? void 0 : _c.commands.messageCommand.commandArgumentSeparator) || ' ');
84
84
  if (parseCommand && parseCommand.command) {
85
85
  const command = this.commands.MESSAGE_COMMANDS[parseCommand.command];
86
- if (command && (0, commandPermissions_1.commandPermissions)(command.name, ((_d = message.member) === null || _d === void 0 ? void 0 : _d.permissions) || null, (_e = this.config) === null || _e === void 0 ? void 0 : _e.permissions.messageCommands)) {
86
+ if ((0, commandPermissions_1.commandPermissions)(command.name, ((_d = message.member) === null || _d === void 0 ? void 0 : _d.permissions) || null, (_e = this.config) === null || _e === void 0 ? void 0 : _e.permissions.messageCommands)) {
87
87
  if (!command.allowExecuteInDM && message.channel.type === 'DM' || !command.allowExecuteByBots && (message.author.bot || message.author.system) || (0, isIgnoredChannel_1.isIgnoredChannel)(message.channelId, (_f = this.config) === null || _f === void 0 ? void 0 : _f.ignoredChannels))
88
88
  return this;
89
89
  if (command.validateOptions && !command.getCommandOptionValues(parseCommand)) {
@@ -99,17 +99,20 @@ class RecipleClient extends discord_js_1.Client {
99
99
  yield Promise.resolve(command.execute(options)).catch(err => this._commandExecuteError(err, options));
100
100
  this.emit('recipleMessageCommandCreate', options);
101
101
  }
102
+ else {
103
+ yield message.reply(((_h = this.config) === null || _h === void 0 ? void 0 : _h.messages.noPermissions) || 'You do not have permission to use this command.').catch((err) => this.logger.error(err));
104
+ }
102
105
  }
103
106
  return this;
104
107
  });
105
108
  }
106
109
  interactionCommandExecute(interaction) {
107
- var _a, _b, _c;
110
+ var _a, _b, _c, _d;
108
111
  return __awaiter(this, void 0, void 0, function* () {
109
112
  if (!interaction || !interaction.isCommand() || !((_a = this.config) === null || _a === void 0 ? void 0 : _a.commands.interactionCommand.enabled))
110
113
  return this;
111
114
  const command = this.commands.INTERACTION_COMMANDS[interaction.commandName];
112
- if (command && (0, commandPermissions_1.commandPermissions)(command.name, interaction.memberPermissions, (_b = this.config) === null || _b === void 0 ? void 0 : _b.permissions.interactionCommands)) {
115
+ if ((0, commandPermissions_1.commandPermissions)(command.name, interaction.memberPermissions, (_b = this.config) === null || _b === void 0 ? void 0 : _b.permissions.interactionCommands)) {
113
116
  if (!command.allowExecuteInDM && interaction.member === null || (0, isIgnoredChannel_1.isIgnoredChannel)(interaction.channelId, (_c = this.config) === null || _c === void 0 ? void 0 : _c.ignoredChannels))
114
117
  return this;
115
118
  const options = {
@@ -121,6 +124,9 @@ class RecipleClient extends discord_js_1.Client {
121
124
  yield Promise.resolve(command.execute(options)).catch(err => this._commandExecuteError(err, options));
122
125
  this.emit('recipleInteractionCommandCreate', options);
123
126
  }
127
+ else {
128
+ yield interaction.reply(((_d = this.config) === null || _d === void 0 ? void 0 : _d.messages.noPermissions) || 'You do not have permission to use this command.').catch((err) => this.logger.error(err));
129
+ }
124
130
  return this;
125
131
  });
126
132
  }
@@ -104,7 +104,7 @@ class MessageCommandBuilder {
104
104
  const arg = args[i];
105
105
  if (!arg && option.required)
106
106
  return;
107
- if (!option.validate(arg))
107
+ if (typeof arg !== 'undefined' && !option.validate(arg))
108
108
  return;
109
109
  result = [...result, { name: option.name, value: arg, required: option.required }];
110
110
  i++;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reciple",
3
- "version": "1.0.10",
3
+ "version": "1.0.13",
4
4
  "description": "A Discord.js bot",
5
5
  "author": "FalloutStudios",
6
6
  "license": "GPL-3.0",
@@ -45,7 +45,7 @@ client:
45
45
 
46
46
  messages:
47
47
  notEnoughArguments: 'Not enough arguments.'
48
- noPermission:
48
+ noPermissions:
49
49
  content: 'You do not have permission to use this command.'
50
50
  ephemeral: true
51
51
  error: