reciple 1.0.11 → 1.0.14

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.
@@ -76,14 +76,16 @@ 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 (!command)
87
+ return this;
88
+ 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
89
  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
90
  return this;
89
91
  if (command.validateOptions && !command.getCommandOptionValues(parseCommand)) {
@@ -99,19 +101,24 @@ class RecipleClient extends discord_js_1.Client {
99
101
  yield Promise.resolve(command.execute(options)).catch(err => this._commandExecuteError(err, options));
100
102
  this.emit('recipleMessageCommandCreate', options);
101
103
  }
104
+ else {
105
+ 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));
106
+ }
102
107
  }
103
108
  return this;
104
109
  });
105
110
  }
106
111
  interactionCommandExecute(interaction) {
107
- var _a, _b, _c;
112
+ var _a, _b, _c, _d;
108
113
  return __awaiter(this, void 0, void 0, function* () {
109
114
  if (!interaction || !interaction.isCommand() || !((_a = this.config) === null || _a === void 0 ? void 0 : _a.commands.interactionCommand.enabled))
110
115
  return this;
111
116
  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)) {
117
+ if ((0, commandPermissions_1.commandPermissions)(command.name, interaction.memberPermissions, (_b = this.config) === null || _b === void 0 ? void 0 : _b.permissions.interactionCommands)) {
113
118
  if (!command.allowExecuteInDM && interaction.member === null || (0, isIgnoredChannel_1.isIgnoredChannel)(interaction.channelId, (_c = this.config) === null || _c === void 0 ? void 0 : _c.ignoredChannels))
114
119
  return this;
120
+ if (!command)
121
+ return this;
115
122
  const options = {
116
123
  interaction: interaction,
117
124
  command: command,
@@ -121,6 +128,9 @@ class RecipleClient extends discord_js_1.Client {
121
128
  yield Promise.resolve(command.execute(options)).catch(err => this._commandExecuteError(err, options));
122
129
  this.emit('recipleInteractionCommandCreate', options);
123
130
  }
131
+ else {
132
+ 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));
133
+ }
124
134
  return this;
125
135
  });
126
136
  }
@@ -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.11",
3
+ "version": "1.0.14",
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: