Updating due to casting errors because of serialized ConfigRepository data

This commit is contained in:
Sean "Solao Bajiuik" Stoves 2020-06-15 21:08:31 -04:00
parent eaf5ed9889
commit 843e9f4808

View File

@ -120,10 +120,10 @@ namespace ChaosBot.Discord.Modules
[Command("raffle buy")] [Command("raffle buy")]
public async Task RaffleCommandBuy(int amount = 1) public async Task RaffleCommandBuy(int amount = 1)
{ {
int cost = ConfigurationRepository.GetValue<int>($"Raffle:Cost", Context.Guild.Id) * amount; int cost = Convert.ToInt32(ConfigurationRepository.GetValue<string>($"Raffle:Cost", Context.Guild.Id)) * amount;
long curPoints = PointsRepository.Total(Convert.ToInt64(Context.User.Id), Convert.ToInt64(Context.Guild.Id)); 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 curRaffle = RaffleRepository.Count(Convert.ToInt64(Context.User.Id), Convert.ToInt64(Context.Guild.Id));
int maxRaffle = ConfigurationRepository.GetValue<int>($"Raffle:Max", Context.Guild.Id); int maxRaffle = Convert.ToInt32(ConfigurationRepository.GetValue<string>($"Raffle:Max", Context.Guild.Id));
int newRaffle = curRaffle + amount; int newRaffle = curRaffle + amount;
Console.WriteLine($"curPoints: {curPoints}, curRaffle: {curRaffle}, maxRaffle: {maxRaffle}, newRaffle: {newRaffle}"); Console.WriteLine($"curPoints: {curPoints}, curRaffle: {curRaffle}, maxRaffle: {maxRaffle}, newRaffle: {newRaffle}");
@ -147,7 +147,7 @@ namespace ChaosBot.Discord.Modules
else else
{ {
await ReplyAsync( await ReplyAsync(
$"You cannot buy more then {ConfigurationRepository.GetValue<int>($"Raffle:Max", Context.Guild.Id).ToString()} tickets.", false); $"You cannot buy more then {ConfigurationRepository.GetValue<string>($"Raffle:Max", Context.Guild.Id)} tickets.", false);
_logger.Warn($"{Context.User.Username} has bought {amount} tickets!"); _logger.Warn($"{Context.User.Username} has bought {amount} tickets!");
} }
} }