From d721add201f6a245db9218cce8512b56d4ce867b Mon Sep 17 00:00:00 2001 From: GrishMahat Date: Fri, 31 May 2024 10:46:46 +0545 Subject: [PATCH 1/2] fix --- src/commands/developer/servers.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/commands/developer/servers.js b/src/commands/developer/servers.js index 1956a3c..23b2213 100644 --- a/src/commands/developer/servers.js +++ b/src/commands/developer/servers.js @@ -1,7 +1,7 @@ /** @format */ import { SlashCommandBuilder, EmbedBuilder } from "discord.js"; -import paginateEmbeds from '../../utils/buttonPagination.js'; // Correct import statement +import paginateEmbeds from "../../utils/buttonPagination.js"; // Correct import statement export default { data: new SlashCommandBuilder() @@ -66,7 +66,7 @@ export default { } const embeds = []; - const MAX_FIELDS = 9; + const MAX_FIELDS = 8; for (let i = 0; i < guilds.length; i += MAX_FIELDS) { const currentGuilds = guilds.slice(i, i + MAX_FIELDS); From 856887cd76162b8b8bb552049bba4296f766e546 Mon Sep 17 00:00:00 2001 From: GrishMahat Date: Fri, 31 May 2024 13:06:30 +0545 Subject: [PATCH 2/2] fix the bug wher beg annount can be negative --- src/commands/economy/coinflip.js | 7 +++++++ src/commands/economy/slots.js | 12 ++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/commands/economy/coinflip.js b/src/commands/economy/coinflip.js index d5487b1..d420218 100644 --- a/src/commands/economy/coinflip.js +++ b/src/commands/economy/coinflip.js @@ -20,6 +20,9 @@ export default { .addIntegerOption(option => option.setName('gamble_amount') .setDescription('The amount of clienterr coins you want to gamble.') + .setMinValue(1) + .setMaxValue(30) + .setRequired(true) ) .toJSON(), @@ -36,6 +39,10 @@ export default { const rollResult = interaction.options.getString('roll_result'); const gambleAmount = interaction.options.getInteger('gamble_amount'); const hourlyCooldown = 60 * 60 * 1000; // 1 hour in milliseconds + if (gambleAmount < 0) { + const embed = new EmbedBuilder().setDescription('The bet amount cannot be negative.'); + return interaction.reply({ embeds: [embed], ephemeral: true }); + } // Fetch the user's balance from the database let userBalance = await Balance.findOne({ userId }); diff --git a/src/commands/economy/slots.js b/src/commands/economy/slots.js index 13a450a..9ecc73c 100644 --- a/src/commands/economy/slots.js +++ b/src/commands/economy/slots.js @@ -9,8 +9,11 @@ export default { .setDescription('Play the slot machine.') .addNumberOption(option => option.setName('bet') - .setDescription('Amount to bet (max 10)') - .setRequired(true)) + .setDescription('Amount to bet (max 10)') + .setRequired(true) + .setMaxValue(10) + ) + .toJSON(), userPermissions: [], botPermissions: [], @@ -29,6 +32,11 @@ export default { const rembed = new EmbedBuilder().setDescription('The maximum bet amount is 10 coins.'); return interaction.reply({ embeds: [rembed], ephemeral: true }); } + if (bet < 0) { + const embed = new EmbedBuilder().setDescription('The bet amount cannot be negative.'); + return interaction.reply({ embeds: [embed], ephemeral: true }); + } + const userBalance = await Balance.findOne({ userId }); if (!userBalance || userBalance.balance < bet) {