mirror of
https://github.com/RPCS3/discord-bot.git
synced 2024-12-14 22:38:38 +00:00
35 lines
1.1 KiB
C#
35 lines
1.1 KiB
C#
using System.Threading.Tasks;
|
|
using CompatBot.Database.Providers;
|
|
using CompatBot.Utils;
|
|
using CompatBot.Utils.Extensions;
|
|
using DSharpPlus.EventArgs;
|
|
|
|
namespace CompatBot.EventHandlers
|
|
{
|
|
internal static class AntipiracyMonitor
|
|
{
|
|
public static async Task OnMessageCreated(MessageCreateEventArgs args)
|
|
{
|
|
args.Handled = !await ContentFilter.IsClean(args.Client, args.Message).ConfigureAwait(false);
|
|
}
|
|
|
|
public static async Task OnMessageUpdated(MessageUpdateEventArgs args)
|
|
{
|
|
args.Handled = !await ContentFilter.IsClean(args.Client, args.Message).ConfigureAwait(false);
|
|
}
|
|
|
|
public static async Task OnReaction(MessageReactionAddEventArgs e)
|
|
{
|
|
if (e.User.IsBotSafeCheck())
|
|
return;
|
|
|
|
var emoji = e.Client.GetEmoji(":piratethink:", Config.Reactions.PiracyCheck);
|
|
if (e.Emoji != emoji)
|
|
return;
|
|
|
|
var message = await e.Channel.GetMessageAsync(e.Message.Id).ConfigureAwait(false);
|
|
await ContentFilter.IsClean(e.Client, message).ConfigureAwait(false);
|
|
}
|
|
}
|
|
}
|