From 7712a2c2983c7621fc9c7f0aa34212fff26930cf Mon Sep 17 00:00:00 2001 From: Sean Stoves Date: Wed, 3 Jun 2020 20:08:50 -0400 Subject: [PATCH] Update for Raffle Count --- ChaosBot/Discord/Modules/RaffleSystem.cs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/ChaosBot/Discord/Modules/RaffleSystem.cs b/ChaosBot/Discord/Modules/RaffleSystem.cs index b48db2e..a3c4ebf 100644 --- a/ChaosBot/Discord/Modules/RaffleSystem.cs +++ b/ChaosBot/Discord/Modules/RaffleSystem.cs @@ -60,9 +60,16 @@ namespace ChaosBot.Discord.Modules [Command("raffle add")] [RequireUserPermission(GuildPermission.ManageGuild)] - public async Task RaffleCommandAdd(string user, int amount) + public async Task RaffleCommandAdd(string user, int amount = 1) { - await RaffleCommandHelper("add", user, amount); + if (Program.Cfg.GetValue("Raffle:Max") >= amount) + await RaffleCommandHelper("add", user, amount); + else + { + await ReplyAsync( + $"You cannot give more then {Program.Cfg.GetValue("Raffle:Max").ToString()} tickets at a time", false); + _logger.Warn($"{Context.User.Username} attempted to give {amount} tickets to {user}!"); + } } [Command("raffle pick")] @@ -84,7 +91,7 @@ namespace ChaosBot.Discord.Modules { await RaffleCommandHelper("status", $"<@!{Context.User.Id}>"); } - + private async Task RaffleCommandHelper(string action, string user = null, int amount = 0) { try { @@ -149,7 +156,7 @@ namespace ChaosBot.Discord.Modules sb.AppendLine($"{Context.User.Mention} has added {amount} rafflepoints to <@{userId}>."); sb.AppendLine(); - sb.AppendLine($"<@{userId}> now has WIP rafflepoints!"); + sb.AppendLine($"<@{userId}> now has {RaffleRepository.selectUser(userId.ToString()).Length} rafflepoints!"); } private void PickRaffle(StringBuilder sb)