finishing ship command and adding await in choose

This commit is contained in:
Runebaas 2017-05-15 23:38:23 +02:00
parent 6a33bddadb
commit 9e6773a022
2 changed files with 32 additions and 10 deletions

View file

@ -18,7 +18,7 @@ namespace Geekbot.net.Modules
{
var choicesArray = choices.Split(';');
var choice = rnd.Client.Next(choicesArray.Length);
ReplyAsync($"I choose **{choicesArray[choice]}**");
await ReplyAsync($"I choose **{choicesArray[choice]}**");
}
}
}

View file

@ -45,31 +45,53 @@ namespace Geekbot.net.Modules
shippingRate = int.Parse(dbval.ToString());
}
var reply = "";
reply = reply + $"{user1.Username} :heart: {user2.Username}\r\n";
reply = reply + $"0% [----{shippingRate}%----] 100% - {determinateSuccess(shippingRate)}";
ReplyAsync(reply);
var reply = ":heartpulse: **Matchmaking** :heartpulse:\r\n";
reply = reply + $":two_hearts: {user1.Mention} :heart: {user2.Mention} :two_hearts:\r\n";
reply = reply + $"0% [{BlockCounter(shippingRate)}] 100% - {DeterminateSuccess(shippingRate)}";
await ReplyAsync(reply);
}
private string determinateSuccess(int rate)
private string DeterminateSuccess(int rate)
{
if (rate < 20)
{
return "Not gonna happen";
} if (rate >= 20 && rate < 40)
{
return "A slight chance";
return "Not such a good idea";
} if (rate >= 40 && rate < 60)
{
return "Perhaps it could work";
return "There might be a chance";
} if (rate >= 60 && rate < 80)
{
return "A good match";
return "Almost a match, but could work";
} if (rate >= 80)
{
return "10/10";
return "It's a match";
}
return "a";
}
private string BlockCounter(int rate)
{
var amount = Math.Floor(decimal.Floor(rate / 10));
Console.WriteLine(amount);
var blocks = "";
for(int i = 1; i <= 10; i++)
{
if(i <= amount)
{
blocks = blocks + ":white_medium_small_square:";
if(i == amount)
{
blocks = blocks + $" {rate}% ";
}
} else
{
blocks = blocks + ":black_medium_small_square:";
}
}
return blocks;
}
}
}