From fdf5a4074bcc6999e81596b8444cf9d957e20be5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Gro=C3=9F?= Date: Mon, 3 Apr 2023 17:16:23 +0200 Subject: [PATCH] Wishlist: Implement Patreon perks for wishlist slots --- commands/wishlist.js | 15 ++++++++++----- config/constants.js | 5 +++++ 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/commands/wishlist.js b/commands/wishlist.js index 0fbb67d..49d1316 100644 --- a/commands/wishlist.js +++ b/commands/wishlist.js @@ -1,6 +1,7 @@ -const { SlashCommandBuilder } = require("discord.js"); +const { SlashCommandBuilder, IntegrationApplication } = require("discord.js"); const { Wishlist, Character } = require("../models"); const UserUtils = require("../util/users"); +const { BASE_VALUES } = require("../config/constants"); module.exports = { data: new SlashCommandBuilder() @@ -48,9 +49,13 @@ module.exports = { wishlist.Characters = [] await interaction.channel.send("Created new wishlist"); } + + let patreonSlots = (await UserUtils.getPatreonPerks(interaction.client, user))['perks']?.['modifiers']['wishlist'] || 0; + let slotasAvailable = BASE_VALUES.wishlist_slots + patreonSlots; + switch (interaction.options.getSubcommand()) { case "view": - let reply = `Wishlist entries (${wishlist.Characters.length}/5 used):\n`; + let reply = `Wishlist entries (${wishlist.Characters.length}/${slotasAvailable} used):\n`; wishlist.Characters.forEach(character => { reply += `${character.name} \n`; }); @@ -65,13 +70,13 @@ module.exports = { if (await wishlist.hasCharacter(character)) { await wishlist.removeCharacter(character) - await interaction.editReply(`Removed ${character.name} from your wishlist! ${wishlist.Characters.length-1}/5 used`); + await interaction.editReply(`Removed ${character.name} from your wishlist! ${wishlist.Characters.length-1}/${slotasAvailable} used`); } else { if (wishlist.Characters.length < 5) { await wishlist.addCharacter(character); - await interaction.editReply(`Added ${character.name} to your wishlist! ${wishlist.Characters.length+1}/5 used`); + await interaction.editReply(`Added ${character.name} to your wishlist! ${wishlist.Characters.length+1}/${slotasAvailable} used`); } else { - await interaction.editReply(`You have no remaining wishlist slots! ${wishlist.Characters.length}`); + await interaction.editReply(`You have no remaining wishlist slots! ${wishlist.Characters.length}/${slotasAvailable} used`); } } break; diff --git a/config/constants.js b/config/constants.js index 19802d1..b05c89b 100644 --- a/config/constants.js +++ b/config/constants.js @@ -62,6 +62,10 @@ const QUALITY_VALUES = { } } +const BASE_VALUES = { + wishlist_slots : 5 +} + const DAILY_REWARDS = { primary_currency : 250, secondary_currency : 5, @@ -126,5 +130,6 @@ exports.CURRENCY_SYMBOLS = CURRENCY_SYMBOLS; exports.QUALITY_SYMBOLS = QUALITY_SYMBOLS; exports.CURRENCY_NAMES = CURRENCY_NAMES; exports.QUALITY_VALUES = QUALITY_VALUES; +exports.BASE_VALUES = BASE_VALUES; exports.DAILY_REWARDS = DAILY_REWARDS; exports.PATREON = PATREON; \ No newline at end of file