From 843e9f480845de095ede1b1e5b4fbc99a1bee5be Mon Sep 17 00:00:00 2001 From: Sean Stoves Date: Mon, 15 Jun 2020 21:08:31 -0400 Subject: [PATCH] Updating due to casting errors because of serialized ConfigRepository data --- ChaosBot/Discord/Modules/RaffleSystem.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ChaosBot/Discord/Modules/RaffleSystem.cs b/ChaosBot/Discord/Modules/RaffleSystem.cs index c954d1d..07ad48e 100644 --- a/ChaosBot/Discord/Modules/RaffleSystem.cs +++ b/ChaosBot/Discord/Modules/RaffleSystem.cs @@ -120,10 +120,10 @@ namespace ChaosBot.Discord.Modules [Command("raffle buy")] public async Task RaffleCommandBuy(int amount = 1) { - int cost = ConfigurationRepository.GetValue($"Raffle:Cost", Context.Guild.Id) * amount; + int cost = Convert.ToInt32(ConfigurationRepository.GetValue($"Raffle:Cost", Context.Guild.Id)) * amount; long curPoints = PointsRepository.Total(Convert.ToInt64(Context.User.Id), Convert.ToInt64(Context.Guild.Id)); int curRaffle = RaffleRepository.Count(Convert.ToInt64(Context.User.Id), Convert.ToInt64(Context.Guild.Id)); - int maxRaffle = ConfigurationRepository.GetValue($"Raffle:Max", Context.Guild.Id); + int maxRaffle = Convert.ToInt32(ConfigurationRepository.GetValue($"Raffle:Max", Context.Guild.Id)); int newRaffle = curRaffle + amount; Console.WriteLine($"curPoints: {curPoints}, curRaffle: {curRaffle}, maxRaffle: {maxRaffle}, newRaffle: {newRaffle}"); @@ -147,7 +147,7 @@ namespace ChaosBot.Discord.Modules else { await ReplyAsync( - $"You cannot buy more then {ConfigurationRepository.GetValue($"Raffle:Max", Context.Guild.Id).ToString()} tickets.", false); + $"You cannot buy more then {ConfigurationRepository.GetValue($"Raffle:Max", Context.Guild.Id)} tickets.", false); _logger.Warn($"{Context.User.Username} has bought {amount} tickets!"); } }