Merge branch 'master' of ssh://git.chaoticlogic.us:2302/discord-bots/chaosbot

This commit is contained in:
Daniel_I_Am 2020-06-04 02:14:18 +02:00
commit 0a6dab9cf5
No known key found for this signature in database
GPG Key ID: 80C428FCC9743E84

View File

@ -60,9 +60,16 @@ namespace ChaosBot.Discord.Modules
[Command("raffle add")] [Command("raffle add")]
[RequireUserPermission(GuildPermission.ManageGuild)] [RequireUserPermission(GuildPermission.ManageGuild)]
public async Task RaffleCommandAdd(string user, int amount) public async Task RaffleCommandAdd(string user, int amount = 1)
{ {
if (Program.Cfg.GetValue<int>("Raffle:Max") >= amount)
await RaffleCommandHelper("add", user, amount); await RaffleCommandHelper("add", user, amount);
else
{
await ReplyAsync(
$"You cannot give more then {Program.Cfg.GetValue<int>("Raffle:Max").ToString()} tickets at a time", false);
_logger.Warn($"{Context.User.Username} attempted to give {amount} tickets to {user}!");
}
} }
[Command("raffle pick")] [Command("raffle pick")]
@ -149,7 +156,7 @@ namespace ChaosBot.Discord.Modules
sb.AppendLine($"{Context.User.Mention} has added {amount} rafflepoints to <@{userId}>."); sb.AppendLine($"{Context.User.Mention} has added {amount} rafflepoints to <@{userId}>.");
sb.AppendLine(); 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) private void PickRaffle(StringBuilder sb)
@ -171,8 +178,8 @@ namespace ChaosBot.Discord.Modules
{ {
ulong userId = Convert.ToUInt64(user.Substring(3, user.Length-4)); ulong userId = Convert.ToUInt64(user.Substring(3, user.Length-4));
sb.AppendLine($"<@{userId}>, you have {_currentPot.GetValueOrDefault(userId)} rafflepoints."); sb.AppendLine($"<@{userId}>, you have {RaffleRepository.selectUser(userId.ToString()).Length} rafflepoints.");
sb.AppendLine($"There is a total of {_currentPot.Values.Sum()} rafflepoints."); sb.AppendLine($"There is a total of {RaffleRepository.all().Length} rafflepoints.");
} }
} }
} }