diff --git a/ChaosBot/Discord/Modules/RaffleSystem.cs b/ChaosBot/Discord/Modules/RaffleSystem.cs index bfeb5cf..b2cec50 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) @@ -171,8 +178,8 @@ namespace ChaosBot.Discord.Modules { ulong userId = Convert.ToUInt64(user.Substring(3, user.Length-4)); - sb.AppendLine($"<@{userId}>, you have {_currentPot.GetValueOrDefault(userId)} rafflepoints."); - sb.AppendLine($"There is a total of {_currentPot.Values.Sum()} rafflepoints."); + sb.AppendLine($"<@{userId}>, you have {RaffleRepository.selectUser(userId.ToString()).Length} rafflepoints."); + sb.AppendLine($"There is a total of {RaffleRepository.all().Length} rafflepoints."); } } } \ No newline at end of file