Adding for guildId

This commit is contained in:
Sean "Solao Bajiuik" Stoves 2020-06-03 21:07:02 -04:00
parent 462a67e252
commit 344871d392

View File

@ -141,17 +141,15 @@ namespace ChaosBot.Discord.Modules
List<Raffle> raffles = new List<Raffle>(); List<Raffle> raffles = new List<Raffle>();
for (int i = 0; i < amount; i++) for (int i = 0; i < amount; i++)
raffles.Add(new Raffle(userId.ToString())); raffles.Add(new Raffle(userId.ToString(), Context.Guild.Id.ToString()));
RaffleRepository.MassInsert(raffles); RaffleRepository.MassInsert(raffles);
} }
else else
{ {
RaffleRepository.Insert(new Raffle(userId.ToString())); RaffleRepository.Insert(new Raffle(userId.ToString(), Context.Guild.Id.ToString()));
} }
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 {RaffleRepository.Count(userId.ToString())} rafflepoints!"); sb.AppendLine($"<@{userId}> now has {RaffleRepository.Count(userId.ToString())} rafflepoints!");
@ -159,8 +157,8 @@ namespace ChaosBot.Discord.Modules
private void PickRaffle(StringBuilder sb) private void PickRaffle(StringBuilder sb)
{ {
Raffle winner = RaffleRepository.PickRandom(); Raffle winner = RaffleRepository.PickRandom(Context.Guild.Id.ToString());
RaffleRepository.Delete(winner.id); RaffleRepository.Delete(winner.id, Context.Guild.Id.ToString());
sb.Append($"<@{winner.userId}> has won the raffle!"); sb.Append($"<@{winner.userId}> has won the raffle!");
} }
@ -168,7 +166,7 @@ namespace ChaosBot.Discord.Modules
{ {
int Removed = RaffleRepository.Count(); int Removed = RaffleRepository.Count();
RaffleRepository.ClearRaffle(); RaffleRepository.ClearRaffle(Context.Guild.Id.ToString());
sb.AppendLine($"{Context.User.Mention} has cleared all {Removed} rafflepoints"); sb.AppendLine($"{Context.User.Mention} has cleared all {Removed} rafflepoints");
} }
@ -177,8 +175,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 {RaffleRepository.Count(userId.ToString())} rafflepoints."); sb.AppendLine($"<@{userId}>, you have {RaffleRepository.Count(userId.ToString(), Context.Guild.Id.ToString())} rafflepoints.");
sb.AppendLine($"There is a total of {RaffleRepository.Count()} rafflepoints."); sb.AppendLine($"There is a total of {RaffleRepository.Count(Context.Guild.Id.ToString())} rafflepoints.");
} }
} }
} }