diff --git a/changelog.md b/changelog.md index cd8aaba..c21c669 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,13 @@ # Pokéstar Changelog +### 1.1.1 + +- Increase spawned Pokemon duration 15 min -> 30 min +- Fix some performance issues +- Fix `/help` bug +- Add vote, events to tutorial +- Fix a weird voting bug + TODO: - Stretch: New event diff --git a/src/config/questConfig.js b/src/config/questConfig.js index acda343..a6a2c1c 100644 --- a/src/config/questConfig.js +++ b/src/config/questConfig.js @@ -4,7 +4,7 @@ const { emojis } = require("../enums/emojis"); const { pokemonIdEnum } = require("../enums/pokemonEnums"); const { checkNumPokemon, listPokemons } = require("../services/pokemon"); const { backpackCategories, backpackItems } = require("./backpackConfig"); -const { SUPPORT_SERVER_INVITE } = require("./helpConfig"); +const { SUPPORT_SERVER_INVITE, gameEventConfig } = require("./helpConfig"); const { locations } = require("./locationConfig"); const { difficulties } = require("./npcConfig"); const { shopItems } = require("./shopConfig"); @@ -112,6 +112,23 @@ const newTutorialConfigRaw = { image: "https://raw.githubusercontent.com/ewei068/pokestar/main/media/images/tutorial/backpack.png", }, + voting: { + name: "(Optional) Voting", + emoji: "🗳️", + description: + "Voting for Pokestar helps the bot grow! **Vote for Pokestar on top.gg [here](https://top.gg/bot/1093411444877439066/vote)**. Then, use `/vote` to claim your rewards.\n\n" + + `Voting gives you many rewards, and voting consistently gives you a streak. With a max streak, **you can get up to 15x ${emojis.POKEBALL} Pokeballs every 12 hours!**`, + requirementString: "Complete the previous stage", + proceedString: + "(Optional) Vote for Pokestar on top.gg, and complete the previous stage.", + checkRequirements: async (trainer) => + trainer.tutorialData.completedTutorialStages.backpack, + rewards: { + money: 1000, + }, + image: + "https://raw.githubusercontent.com/ewei068/pokestar/refs/heads/main/media/images/tutorial/vote.png", + }, catchSixPokemon: { name: "Catch More Pokemon", emoji: emojis.GREATBALL, @@ -407,6 +424,21 @@ const newTutorialConfigRaw = { image: "https://raw.githubusercontent.com/ewei068/pokestar/main/media/images/pve.gif", }, + events: { + name: "Events", + emoji: "🎉", + description: + "Pokestar has events which provide **limited-time rewards, benefits, and custom Pokemon!** Use `/events` to view ongoing events.", + requirementString: "Complete the previous stage", + proceedString: + "Use `/events` to view ongoing events, and complete the previous stage.", + checkRequirements: async (trainer) => + trainer.tutorialData.completedTutorialStages.winEasyDifficulty, + rewards: { + money: 1000, + }, + image: gameEventConfig[0]?.image, + }, userSettings: { name: "Settings", emoji: "⚙️", @@ -416,7 +448,7 @@ const newTutorialConfigRaw = { proceedString: "Use `/settings` to view and change your settings, and complete the previous stage.", checkRequirements: async (trainer) => - trainer.tutorialData.completedTutorialStages.winEasyDifficulty, + trainer.tutorialData.completedTutorialStages.events, rewards: { money: 1000, }, diff --git a/src/config/trainerConfig.js b/src/config/trainerConfig.js index 62683e8..db63e90 100644 --- a/src/config/trainerConfig.js +++ b/src/config/trainerConfig.js @@ -384,10 +384,20 @@ const trainerFields = { }, voting: { type: "object", - default: { - lastVoted: new Date(0).getTime(), - streak: 0, - rewards: 0, + default: {}, + config: { + lastVoted: { + type: "number", + default: new Date(0).getTime(), + }, + streak: { + type: "number", + default: 0, + }, + rewards: { + type: "number", + default: 0, + }, }, }, trade: { diff --git a/src/deact/interactions.js b/src/deact/interactions.js index b24dc23..98b79d4 100644 --- a/src/deact/interactions.js +++ b/src/deact/interactions.js @@ -47,8 +47,11 @@ const removeInteractionInstance = (interaction) => { deleteInteraction(interaction.id); }; +const getInteractionCount = () => Object.keys(interactions).length; + module.exports = { setInteractionInstance, getInteractionInstance, removeInteractionInstance, + getInteractionCount, }; diff --git a/src/elements/help/HelpCategoryList.js b/src/elements/help/HelpCategoryList.js index 21dae8f..67e3e02 100644 --- a/src/elements/help/HelpCategoryList.js +++ b/src/elements/help/HelpCategoryList.js @@ -46,7 +46,7 @@ module.exports = async (ref, { initialPage = 1, initialCommand = null }) => { ) { return { initialCategoryFound: category, - initialCommandFound: providedCommand, + initialCommandFound: commandData.aliases[0], err: null, }; } diff --git a/src/index.js b/src/index.js index ea7fffb..f336caf 100644 --- a/src/index.js +++ b/src/index.js @@ -23,6 +23,7 @@ const { cleanupRaids } = require("./services/raid"); const { initialize: initializeBattleData, } = require("./battle/data/initialize"); +const { getInteractionCount } = require("./deact/interactions"); console.log(`STAGE: ${process.env.STAGE}`); const FFLAG_ENABLE_SPAWN = process.env.FFLAG_ENABLE_SPAWN === "1"; @@ -170,7 +171,10 @@ client.once(Events.ClientReady, (c) => { poll(async () => { try { const stateSize = getStateCount(); - logger.info(`STATE SIZE: ${stateSize}`); + const interactionCount = getInteractionCount(); + logger.info( + `STATE SIZE: ${stateSize} | INTERACTION COUNT: ${interactionCount}` + ); } catch { logger.warn("Error polling state size"); } diff --git a/src/services/spawn.js b/src/services/spawn.js index 89cb142..0fa4e1f 100644 --- a/src/services/spawn.js +++ b/src/services/spawn.js @@ -118,7 +118,7 @@ const buildPokemonSpawnSend = (goodSpawn) => { level, goodSpawn, }, - 15 * 60 + 30 * 60 ); const buttonConfigs = [ {