Make opinions always the same for the same parameter, made opinions about bans random

This commit is contained in:
Deukhoofd 2018-03-30 16:50:16 +02:00
parent 865f8a5083
commit 50b5a9f735
No known key found for this signature in database
GPG Key ID: B4C087AC81641654
1 changed files with 4 additions and 4 deletions

View File

@ -8,10 +8,10 @@ namespace DeukBot4.Utilities
{
public static async Task<string> GetOpinion(CommandRequest request)
{
var random = new Random();
var extend = request.Parameters[0].AsString().ToLowerInvariant();
var random = new Random(extend.GetHashCode());
var positive = random.Next(-20, 80) < (int) request.RequestPermissions;
var extend = request.Parameters[0].AsString().ToLowerInvariant();
if (extend.Contains("kill") || extend.Contains("suicide"))
{
return "That sounds like a bad idea to me";
@ -24,11 +24,11 @@ namespace DeukBot4.Utilities
}
else
{
return "Absolutely, ban the fucker!";
return BanOpinions.Choice(random);
}
}
return positive ?PositiveOpinions.Choice(random) : NegativeOpinions.Choice(random);
return positive ? PositiveOpinions.Choice(random) : NegativeOpinions.Choice(random);
}