Make thanks responses iterate as to prevent responses from repeating themselves often

This commit is contained in:
Deukhoofd 2018-08-12 13:49:25 +02:00
parent 6097515b5b
commit 929abcf7e0
No known key found for this signature in database
GPG Key ID: B4C087AC81641654
1 changed files with 4 additions and 2 deletions

View File

@ -75,14 +75,16 @@ namespace DeukBot4.MessageHandlers
"It was the least I could do, I always do the least I can do!", "It was the least I could do, I always do the least I can do!",
"Yes, well, we'd be absolutely nowhere without me.", "Yes, well, we'd be absolutely nowhere without me.",
"Yeah no problem, I'm the only one who does work around here anyway", "Yeah no problem, I'm the only one who does work around here anyway",
"I gotchu, bb."
}; };
private static readonly Random Rand = new Random(); private static int _pos = 0;
public static async Task ThanksHandler(SocketMessage message) public static async Task ThanksHandler(SocketMessage message)
{ {
var content = message.Content; var content = message.Content;
if (ThanksMatcher.IsMatch(content)) if (ThanksMatcher.IsMatch(content))
{ {
var response = ThanksResponses[Rand.Next(0, ThanksResponses.Length)]; var response = ThanksResponses[_pos];
_pos = (_pos + 1) % ThanksResponses.Length;
message.Channel.SendMessageAsync(response); message.Channel.SendMessageAsync(response);
} }
} }