General cleanup
This commit is contained in:
parent
bbbb847110
commit
8617dbae2f
@ -11,7 +11,7 @@ namespace ChaosBot.Database.Repository
|
||||
{
|
||||
private static readonly string Table = "RaffleTable";
|
||||
|
||||
public static Raffle[] all()
|
||||
public static Raffle[] All()
|
||||
{
|
||||
DataTable dataTable = Controller.SelectQuery(Table);
|
||||
|
||||
@ -27,14 +27,14 @@ namespace ChaosBot.Database.Repository
|
||||
return raffles.ToArray();
|
||||
}
|
||||
|
||||
public static int count()
|
||||
public static int Count()
|
||||
{
|
||||
DataTable dataTable = Controller.SelectQuery(Table, "COUNT(*)");
|
||||
|
||||
return Convert.ToInt32(dataTable.Rows[0]["COUNT(*)"]);
|
||||
}
|
||||
|
||||
public static int count(string userId)
|
||||
public static int Count(string userId)
|
||||
{
|
||||
Dictionary<string, object> filterDict = new Dictionary<string, object>();
|
||||
filterDict.Add("userId", userId);
|
||||
@ -63,7 +63,7 @@ namespace ChaosBot.Database.Repository
|
||||
return raffles.ToArray();
|
||||
}
|
||||
|
||||
public static void insert(Raffle raffle)
|
||||
public static void Insert(Raffle raffle)
|
||||
{
|
||||
Dictionary<string, object> dict = new Dictionary<string, object>();
|
||||
|
||||
@ -72,7 +72,7 @@ namespace ChaosBot.Database.Repository
|
||||
Controller.InsertQuery(Table, dict);
|
||||
}
|
||||
|
||||
public static void massInsert(List<Raffle> raffles)
|
||||
public static void MassInsert(List<Raffle> raffles)
|
||||
{
|
||||
foreach (var raf in raffles)
|
||||
{
|
||||
@ -94,7 +94,7 @@ namespace ChaosBot.Database.Repository
|
||||
return new Raffle(idFetch, userIdFetch);
|
||||
}
|
||||
|
||||
public static int clearRaffle()
|
||||
public static int ClearRaffle()
|
||||
{
|
||||
List<SqliteCommand> cmds = new List<SqliteCommand>();
|
||||
|
||||
@ -103,7 +103,7 @@ namespace ChaosBot.Database.Repository
|
||||
|
||||
return Controller.TransactionQuery(cmds);
|
||||
}
|
||||
// public static void delete()
|
||||
// public static void Delete()
|
||||
// {
|
||||
//
|
||||
// }
|
||||
|
||||
@ -17,8 +17,6 @@ namespace ChaosBot.Discord.Modules
|
||||
{
|
||||
private static Logger _logger = Program._logger;
|
||||
|
||||
private static Dictionary<ulong, int> _currentPot = new Dictionary<ulong, int>();
|
||||
|
||||
[Command("raffle")]
|
||||
[Alias("raffle info")]
|
||||
[RequireUserPermission(GuildPermission.ManageGuild)]
|
||||
@ -145,18 +143,18 @@ namespace ChaosBot.Discord.Modules
|
||||
for (int i = 0; i < amount; i++)
|
||||
raffles.Add(new Raffle(userId.ToString()));
|
||||
|
||||
RaffleRepository.massInsert(raffles);
|
||||
RaffleRepository.MassInsert(raffles);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
RaffleRepository.insert(new Raffle(userId.ToString()));
|
||||
RaffleRepository.Insert(new Raffle(userId.ToString()));
|
||||
}
|
||||
|
||||
|
||||
sb.AppendLine($"{Context.User.Mention} has added {amount} rafflepoints to <@{userId}>.");
|
||||
sb.AppendLine();
|
||||
sb.AppendLine($"<@{userId}> now has {RaffleRepository.count(userId.ToString())} rafflepoints!");
|
||||
sb.AppendLine($"<@{userId}> now has {RaffleRepository.Count(userId.ToString())} rafflepoints!");
|
||||
}
|
||||
|
||||
private void PickRaffle(StringBuilder sb)
|
||||
@ -167,7 +165,7 @@ namespace ChaosBot.Discord.Modules
|
||||
|
||||
private void ClearRaffle(StringBuilder sb, bool noOutput = false)
|
||||
{
|
||||
int Removed = RaffleRepository.clearRaffle();
|
||||
int Removed = RaffleRepository.ClearRaffle();
|
||||
|
||||
sb.AppendLine($"{Context.User.Mention} has cleared all {Removed} rafflepoints");
|
||||
}
|
||||
@ -176,8 +174,8 @@ namespace ChaosBot.Discord.Modules
|
||||
{
|
||||
ulong userId = Convert.ToUInt64(user.Substring(3, user.Length-4));
|
||||
|
||||
sb.AppendLine($"<@{userId}>, you have {RaffleRepository.count(userId.ToString())} rafflepoints.");
|
||||
sb.AppendLine($"There is a total of {RaffleRepository.count()} rafflepoints.");
|
||||
sb.AppendLine($"<@{userId}>, you have {RaffleRepository.Count(userId.ToString())} rafflepoints.");
|
||||
sb.AppendLine($"There is a total of {RaffleRepository.Count()} rafflepoints.");
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user