33 lines
1.1 KiB
C#
33 lines
1.1 KiB
C#
using System.Text.RegularExpressions;
|
|
using System.Threading.Tasks;
|
|
using DeukBot4.Database;
|
|
using DeukBot4.MessageHandlers.CommandHandler;
|
|
using Discord;
|
|
using Discord.WebSocket;
|
|
|
|
namespace DeukBot4.MessageHandlers.JokeHandling
|
|
{
|
|
public class OwoHandler : IJokeController
|
|
{
|
|
public string Id => "owo-warn";
|
|
public string Name => "Owo Warnings";
|
|
|
|
private static readonly Regex Matcher = new Regex(@"(?:^|\s).w.(?:\s|$)", RegexOptions.IgnoreCase);
|
|
|
|
public async Task Run(SocketMessage message)
|
|
{
|
|
if (!(message.Channel is IGuildChannel serverChannel))
|
|
return;
|
|
|
|
if (!Matcher.Match(message.Content).Success)
|
|
return;
|
|
|
|
var changePoints = await PointHandler.ChangePoints(serverChannel.GuildId, message.Author.Id, -100);
|
|
var embed = EmbedFactory.GetStandardEmbedBuilder();
|
|
embed.Title = "No Owoing";
|
|
embed.Description =
|
|
$"{message.Author.Mention}, you were fined by -100 points. Your new score is {changePoints}.";
|
|
message.Channel.SendMessageAsync("", embed: embed.Build());
|
|
}
|
|
}
|
|
} |