Add Dub, Trips and Quads check to !checkem (please fix if you see this)

This commit is contained in:
Runebaas 2017-09-15 21:10:22 +02:00
parent 1295ed6206
commit c82d6ec666

View file

@ -19,20 +19,54 @@ namespace Geekbot.net.Modules
[Command("checkem", RunMode = RunMode.Async), Summary("Check for dubs")]
public async Task MuhDubs()
{
try
{
var sb = new StringBuilder();
sb.AppendLine($"Check em {Context.User.Mention}");
sb.AppendLine($"**{rnd.Next(100000, 99999999)}**");
sb.AppendLine(checkEmImages.GetRandomCheckEmPic());
await ReplyAsync(sb.ToString());
}
catch (Exception e)
{
Console.WriteLine(e.Message);
try
{
int number = rnd.Next(10000000, 99999999);
var dubtriqua = "";
var ns = GetIntArray(number);
Console.WriteLine(ns.Length);
if (ns[7] == ns[6])
{
dubtriqua = "DUBS";
if (ns[6] == ns[5])
{
dubtriqua = "TRIPS";
if (ns[5] == ns[4])
{
dubtriqua = "QUADS";
}
}
}
var sb = new StringBuilder();
sb.AppendLine($"Check em {Context.User.Mention}");
sb.AppendLine($"**{number}**");
if (!string.IsNullOrEmpty(dubtriqua))
{
sb.AppendLine($":tada: {dubtriqua} :tada:");
}
sb.AppendLine(checkEmImages.GetRandomCheckEmPic());
await ReplyAsync(sb.ToString());
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
}
private int[] GetIntArray(int num)
{
List<int> listOfInts = new List<int>();
while (num > 0)
{
listOfInts.Add(num % 10);
num = num / 10;
}
listOfInts.Reverse();
return listOfInts.ToArray();
}
}
}