Merge pull request #187 from 13xforever/vnext

I lied. But memes are important
This commit is contained in:
Ilya 2019-01-25 02:40:38 +05:00 committed by GitHub
commit 4c97a9b9cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -282,28 +282,27 @@ namespace CompatBot.Commands
else if (i == 0 && await new DiscordMemberConverter().ConvertAsync(word, ctx).ConfigureAwait(false) is Optional<DiscordMember> member && member.HasValue)
{
var m = member.Value;
if (suffix.Length == 0)
MakeCustomRoleRating(m);
result.Append(m.Mention);
}
else if (nekoMatch.Contains(word))
{
if (!choiceFlags.Contains('n'))
if (i == 0 && suffix.Length == 0)
{
choices = RateAnswers.Concat(Enumerable.Repeat("Ugh", RateAnswers.Count * 3)).ToList();
choiceFlags.Add('n');
}
MakeCustomRoleRating(nekoMember);
}
result.Append(nekoUser.Mention);
}
else if (kdMatch.Contains(word))
{
if (!choiceFlags.Contains('k'))
if (i == 0 && suffix.Length == 0)
{
choices = RateAnswers.Concat(Enumerable.Repeat("RSX genius", RateAnswers.Count * 3)).ToList();
choiceFlags.Add('k');
}
MakeCustomRoleRating(kdMember);
}
result.Append(kdUser.Mention);
}
else
@ -319,11 +318,17 @@ namespace CompatBot.Commands
whatever = whatever.Substring("rate ".Length);
if (whatever == "sonic" || whatever.Contains("sonic the"))
choices = RateAnswers.Concat(Enumerable.Repeat("💩 out of 🦔", RateAnswers.Count)).Concat(new[] {"Sonic out of 🦔", "Sonic out of 10"}).ToList();
if (string.IsNullOrEmpty(whatever))
await ctx.RespondAsync("Rating nothing makes _**so much**_ sense, right?").ConfigureAwait(false);
else
{
var seed = (prefix + whatever).GetHashCode(StringComparison.CurrentCultureIgnoreCase);
var seededRng = new Random(seed);
var answer = choices[seededRng.Next(choices.Count)];
await ctx.RespondAsync(answer).ConfigureAwait(false);
}
}
catch (Exception e)
{
Config.Log.Warn(e, $"Failed to rate {whatever}");