using System.Text.RegularExpressions; using System.Threading.Tasks; using Discord.WebSocket; namespace DeukBot4.MessageHandlers.JokeHandling { internal class ThanksJoke : IJokeController { public string Id => "thanks"; public string Name => "Claim credit when people say thanks"; private readonly Regex ThanksMatcher = new Regex(@"(?i)((\b)thanks*(\W|$)+)"); private readonly string[] ThanksResponses = { "You're welcome!", "No problem", "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 int _pos = 0; public async Task Run(SocketMessage message) { var content = message.Content; if (ThanksMatcher.IsMatch(content)) { var response = ThanksResponses[_pos]; _pos = (_pos + 1) % ThanksResponses.Length; message.Channel.SendMessageAsync(response); } } } }