diff --git a/src/main/kotlin/xyz/pokecord/bot/modules/auction/commands/AuctionCommand.kt b/src/main/kotlin/xyz/pokecord/bot/modules/auction/commands/AuctionCommand.kt index 5db8e1d..bf3f50d 100644 --- a/src/main/kotlin/xyz/pokecord/bot/modules/auction/commands/AuctionCommand.kt +++ b/src/main/kotlin/xyz/pokecord/bot/modules/auction/commands/AuctionCommand.kt @@ -18,7 +18,7 @@ object AuctionCommand : ParentCommand() { override val name = "Auction" override var aliases = arrayOf("ah", "au", "auctions") override val childCommands: MutableList = - mutableListOf(BidCommand, InfoCommand, ListCommand, UnlistCommand, ProfileCommand, RemindCommand) + mutableListOf(BidCommand, InfoCommand, ListCommand, UnlistCommand, ProfileCommand) suspend fun formatAuctions( context: ICommandContext, @@ -69,9 +69,7 @@ object AuctionCommand : ParentCommand() { val templateEmbedBuilder = EmbedBuilder() - .setTitle( - context.translate("modules.auctions.commands.auctions.embeds.title") - ) + .setTitle(context.translate("modules.auction.embeds.auction.title")) .setColor(EmbedTemplates.Color.YELLOW.code) val searchOptions = @@ -103,8 +101,8 @@ object AuctionCommand : ParentCommand() { val count = context.bot.database.auctionRepository.getAuctionCount(aggregation = aggregation.toMutableList()) if (count < 1) { context.reply( - templateEmbedBuilder.setDescription(context.translate("modules.auctions.commands.auctions.errors.noResults")) - .setColor(EmbedTemplates.Color.RED.code).build() + templateEmbedBuilder.setDescription(context.translate("modules.auction.errors.auction.noAuctions")) + .setColor(EmbedTemplates.Color.RED.code).setFooter("misc.embeds.error.footer").build() ).queue() return } @@ -112,8 +110,8 @@ object AuctionCommand : ParentCommand() { val pageCount = ceil((count.toDouble() / 10)).toInt() val paginator = EmbedPaginator(context, pageCount, { pageIndex -> if (pageIndex >= pageCount) { - return@EmbedPaginator templateEmbedBuilder.setDescription(context.translate("modules.auctions.commands.auctions.errors.noResults")) - .setColor(EmbedTemplates.Color.RED.code).setFooter("") + return@EmbedPaginator templateEmbedBuilder.setDescription(context.translate("modules.auction.errors.auction.noResults")) + .setColor(EmbedTemplates.Color.RED.code).setFooter("misc.embeds.error.footer") } val auctionsList = context.bot.database.auctionRepository.getAuctionList( skip = pageIndex * 10, diff --git a/src/main/kotlin/xyz/pokecord/bot/modules/auction/commands/RemindCommand.kt b/src/main/kotlin/xyz/pokecord/bot/modules/auction/commands/RemindCommand.kt deleted file mode 100644 index da39c90..0000000 --- a/src/main/kotlin/xyz/pokecord/bot/modules/auction/commands/RemindCommand.kt +++ /dev/null @@ -1,33 +0,0 @@ -package xyz.pokecord.bot.modules.auction.commands - -import xyz.pokecord.bot.api.ICommandContext -import xyz.pokecord.bot.core.structures.discord.base.Command - -object RemindCommand : Command() { - override val name = "Remind" - override var aliases = arrayOf("rm", "rmd", "reminder") - - @Executor - suspend fun execute(context: ICommandContext) { - if (!context.hasStarted(true)) return - - val userData = context.getUserData() - if(userData.bidNotifications) { - context.reply( - context.embedTemplates.normal( - context.translate("modules.auctions.commands.notify.toggledOff.description"), - context.translate("modules.auctions.commands.notify.toggledOff.title") - ).build() - ).queue() - } else { - context.reply( - context.embedTemplates.normal( - context.translate("modules.auctions.commands.notify.toggledOn.description"), - context.translate("modules.auctions.commands.notify.toggledOn.title") - ).build() - ).queue() - } - - context.bot.database.userRepository.toggleBidNotifications(userData) - } -} \ No newline at end of file diff --git a/src/main/kotlin/xyz/pokecord/bot/modules/general/commands/HelpCommand.kt b/src/main/kotlin/xyz/pokecord/bot/modules/general/commands/HelpCommand.kt index 66871e4..7b85387 100644 --- a/src/main/kotlin/xyz/pokecord/bot/modules/general/commands/HelpCommand.kt +++ b/src/main/kotlin/xyz/pokecord/bot/modules/general/commands/HelpCommand.kt @@ -7,7 +7,7 @@ import xyz.pokecord.bot.utils.EmbedPaginator class HelpCommand : Command() { override val name = "Help" - override var aliases = arrayOf("h", "commands", "command") + override var aliases = arrayOf("h", "cmds", "commands", "command", "cmd") private suspend fun getCommands( context: ICommandContext, diff --git a/src/main/kotlin/xyz/pokecord/bot/modules/pokepedia/commands/PokedexCommand.kt b/src/main/kotlin/xyz/pokecord/bot/modules/pokepedia/commands/PokedexCommand.kt index 926f5e4..bb39bb6 100644 --- a/src/main/kotlin/xyz/pokecord/bot/modules/pokepedia/commands/PokedexCommand.kt +++ b/src/main/kotlin/xyz/pokecord/bot/modules/pokepedia/commands/PokedexCommand.kt @@ -28,13 +28,20 @@ class PokedexCommand : Command() { val id = pokemonNameOrId.toIntOrNull() val pokemon = if (id != null) Pokemon.getById(id) else Pokemon.getByName(pokemonNameOrId) - if (pokemon == null || !pokemon.hasShiny) { + if (pokemon == null) { context.reply( context.embedTemplates.error(context.translate("misc.errors.pokemonNotFound")).build() ).queue() return } + if (!pokemon.hasShiny) { + context.reply( + context.embedTemplates.error(context.translate("modules.pokemon.commands.pokedex.errors.noShiny")).build() + ).queue() + return + } + val genderRate = if (pokemon.species.genderRate == -1) context.translate("misc.texts.genderless") else "${100 - pokemon.species.genderRate * 12.5}% ${context.translate("misc.texts.male")}, ${pokemon.species.genderRate * 12.5}% ${ diff --git a/src/main/kotlin/xyz/pokecord/bot/modules/profile/commands/RemindCommand.kt b/src/main/kotlin/xyz/pokecord/bot/modules/profile/commands/RemindCommand.kt index 3c9dfc4..655455c 100644 --- a/src/main/kotlin/xyz/pokecord/bot/modules/profile/commands/RemindCommand.kt +++ b/src/main/kotlin/xyz/pokecord/bot/modules/profile/commands/RemindCommand.kt @@ -8,22 +8,24 @@ object RemindCommand : Command() { override var aliases = arrayOf("rm", "rms", "rmd", "reminder", "reminders") private val voteAliases = arrayOf("vote", "v", "next vote reminder") + private val auctionAliases = arrayOf("au", "ah", "auction", "auction activity") @Executor suspend fun execute( context: ICommandContext, @Argument(name = "reminder name", optional = true) reminder: String? ) { - val userData = context.getUserData() val enabled = "`ENABLED`" val disabled = "`DISABLED`" + val userData = context.getUserData() if (reminder == null) { context.reply( context.embedTemplates.normal( context.translate("modules.profile.commands.remind.embed.description.base", mapOf( - "vote" to if (userData.voteReminder) enabled else disabled + "vote" to if (userData.voteReminder) enabled else disabled, + "auction" to if (userData.bidNotifications) enabled else disabled ) ), context.translate("modules.profile.commands.remind.embed.title.base", @@ -31,23 +33,44 @@ object RemindCommand : Command() { ) ).setFooter(context.translate("modules.profile.commands.remind.embed.footer")).build() ).queue() + return } else { - val lowerCaseReminder = reminder.lowercase() - val vote = voteAliases.contains(lowerCaseReminder) + val userInput = reminder.lowercase() + val vote = voteAliases.contains(userInput) + val auction = auctionAliases.contains(userInput) - if(vote) { + if (vote) { + context.reply( + context.embedTemplates.normal( + context.translate( + if (userData.voteReminder) "modules.profile.commands.remind.embed.description.disabled" + else "modules.profile.commands.remind.embed.description.enabled" + ), + context.translate( + "modules.profile.commands.remind.embed.title.toggle", + "reminderType" to "Vote" + ) + ).build() + ).queue() module.bot.database.userRepository.toggleVoteReminder(userData) + return + } + + if (auction) { context.reply( context.embedTemplates.normal( context.translate( - if (userData.voteReminder) "modules.profile.commands.remind.embed.description.enabled" - else "modules.profile.commands.remind.embed.description.disabled" + if (userData.voteReminder) "modules.profile.commands.remind.embed.description.disabled" + else "modules.profile.commands.remind.embed.description.enabled" ), - context.translate("modules.profile.commands.remind.embed.title.toggle", - "reminderType" to "Vote") + context.translate( + "modules.profile.commands.remind.embed.title.toggle", + "reminderType" to "Auction" + ) ).build() ).queue() + context.bot.database.userRepository.toggleBidNotifications(userData) return } } diff --git a/src/main/resources/i18n/en-US.yaml b/src/main/resources/i18n/en-US.yaml index c98bb3a..aac8ba5 100644 --- a/src/main/resources/i18n/en-US.yaml +++ b/src/main/resources/i18n/en-US.yaml @@ -55,6 +55,7 @@ misc: #release: Transfers Pokémon to Professor Zihadikarp. select: Selects a Pokémon, becoming your active Pokémon. pokepedia: + forecast: Displays current weather, events, and time of day. move: Displays specified move's information. moveset: Recommends movesets for legendary and mythical Pokémon. pokedex: Displays Pokémon base stats and general information. @@ -64,6 +65,7 @@ misc: "profile.info": Displays user statistics. "profile.pokedex": Displays all Pokémon registered to Pokédex. Includes shinies. private: Toggles your progress visibility to public/private. + remind: Displays all reminders. Specify reminder type for toggling. staff: blacklist: Prevent users from executing Pokecord commands. blacklists: View a full list of all blacklisted users. @@ -1003,6 +1005,10 @@ modules: footers: caught: This Pokémon is registered to your Pokédex! uncaught: This Pokémon has not been registered to your Pokédex! + errors: + noShiny: |- + Pokecord triple checked the records, to no avail. + > **This Pokémon forme/variant has no shiny.** forecast: description: |- *Pokecord is currently detecting no anomalies.* @@ -1192,8 +1198,8 @@ modules: More reminders will be added soon! **Next Vote Reminder**: {{vote}} - disabled: You will no longer receive DMs when your next votes are ready. - enabled: You will now be DMed when your next votes are ready. + disabled: You will no longer be DMed regarding these notifications. + enabled: You will now be DMed when these notifications are due. title: base: "{{user}}'s Reminders" toggle: "{{reminderType}} Reminder Toggled"