Skip to content

Commit

Permalink
Add Infinity checks to remove-money
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMonDon committed Jul 17, 2024
1 parent c8c031d commit a92460d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
4 changes: 3 additions & 1 deletion commands/Economy/remove-money-role.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ class RemoveMoneyRole extends Command {
type = args[0].toLowerCase();
}

if (isNaN(amount)) return this.client.util.errorEmbed(msg, msg.settings.prefix + this.help.usage, 'Invalid Amount');
if (isNaN(amount) || amount === Infinity) {
return this.client.util.errorEmbed(msg, msg.settings.prefix + this.help.usage, 'Invalid Amount');
}
if (!role) return this.client.util.errorEmbed(msg, msg.settings.prefix + this.help.usage, 'Invalid Role');

const members = [...role.members.values()];
Expand Down
4 changes: 3 additions & 1 deletion commands/Economy/remove-money.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ class RemoveMoney extends Command {
type = args[0].toLowerCase();
}

if (isNaN(amount)) return this.client.util.errorEmbed(msg, msg.settings.prefix + this.help.usage, 'Invalid Amount');
if (isNaN(amount) || amount === Infinity) {
return this.client.util.errorEmbed(msg, msg.settings.prefix + this.help.usage, 'Invalid Amount');
}
if (!mem) return this.client.util.errorEmbed(msg, msg.settings.prefix + this.help.usage, 'Invalid Member');
if (mem.user.bot) return this.client.util.errorEmbed(msg, "You can't remove money from bots.");

Expand Down
8 changes: 1 addition & 7 deletions slash_commands/Economy/remove-money.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,7 @@ exports.run = async (interaction) => {
.setColor(interaction.settings.embedErrorColor)
.setAuthor({ name: interaction.user.tag, iconURL: interaction.user.displayAvatarURL() });

if (isNaN(amount)) return interaction.client.util.errorEmbed(interaction, 'Invalid Amount');
if (amount > 1000000000000)
return interaction.client.util.errorEmbed(
interaction,
"You can't add more than 1 Trillion to a member",
'Invalid Amount',
);
if (isNaN(amount) || amount === Infinity) return interaction.client.util.errorEmbed(interaction, 'Invalid Amount');

if (target.user) {
if (!target.user) return interaction.client.util.errorEmbed(interaction, 'Invalid Member');
Expand Down

0 comments on commit a92460d

Please sign in to comment.