From 929abcf7e02894f23861f929dd93fc93ffbe9536 Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Sun, 12 Aug 2018 13:49:25 +0200 Subject: [PATCH] Make thanks responses iterate as to prevent responses from repeating themselves often --- DeukBot4/MessageHandlers/JokeHandlers.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/DeukBot4/MessageHandlers/JokeHandlers.cs b/DeukBot4/MessageHandlers/JokeHandlers.cs index 63da5b6..8dfdab5 100644 --- a/DeukBot4/MessageHandlers/JokeHandlers.cs +++ b/DeukBot4/MessageHandlers/JokeHandlers.cs @@ -75,14 +75,16 @@ namespace DeukBot4.MessageHandlers "It was the least I could do, I always do the least I can do!", "Yes, well, we'd be absolutely nowhere without me.", "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) { var content = message.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); } }