Add sarcastic responses when someone says thanks or thank you
This commit is contained in:
parent
2787fab689
commit
6097515b5b
|
@ -1,4 +1,6 @@
|
||||||
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using DeukBot4.APIHandlers;
|
using DeukBot4.APIHandlers;
|
||||||
using DeukBot4.Utilities;
|
using DeukBot4.Utilities;
|
||||||
|
@ -67,5 +69,23 @@ namespace DeukBot4.MessageHandlers
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static readonly Regex ThanksMatcher = new Regex(@"(?i)((\b)thanks*(\W|$)+)");
|
||||||
|
private static 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",
|
||||||
|
};
|
||||||
|
private static readonly Random Rand = new Random();
|
||||||
|
public static async Task ThanksHandler(SocketMessage message)
|
||||||
|
{
|
||||||
|
var content = message.Content;
|
||||||
|
if (ThanksMatcher.IsMatch(content))
|
||||||
|
{
|
||||||
|
var response = ThanksResponses[Rand.Next(0, ThanksResponses.Length)];
|
||||||
|
message.Channel.SendMessageAsync(response);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -25,6 +25,7 @@ namespace DeukBot4.MessageHandlers
|
||||||
ImageBackupHandler.Backup(message);
|
ImageBackupHandler.Backup(message);
|
||||||
JokeHandlers.DeltaHandler(message);
|
JokeHandlers.DeltaHandler(message);
|
||||||
JokeHandlers.DadJokeHandler(message);
|
JokeHandlers.DadJokeHandler(message);
|
||||||
|
JokeHandlers.ThanksHandler(message);
|
||||||
#pragma warning restore 4014
|
#pragma warning restore 4014
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
|
Loading…
Reference in New Issue