From e4d51b5198acbd6eef165e5771c0a40904df16d6 Mon Sep 17 00:00:00 2001 From: Ske Date: Fri, 26 Jun 2020 01:49:51 +0200 Subject: [PATCH] Explicitly check for bot/WH users before running command handler --- PluralKit.Bot/Handlers/MessageCreated.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/PluralKit.Bot/Handlers/MessageCreated.cs b/PluralKit.Bot/Handlers/MessageCreated.cs index a24deee1..6c99d0ce 100644 --- a/PluralKit.Bot/Handlers/MessageCreated.cs +++ b/PluralKit.Bot/Handlers/MessageCreated.cs @@ -62,9 +62,15 @@ namespace PluralKit.Bot ctx = await conn.QueryMessageContext(evt.Author.Id, evt.Channel.GuildId, evt.Channel.Id); // Try each handler until we find one that succeeds - var _ = await TryHandleLogClean(evt, ctx) || - await TryHandleCommand(evt, ctx) || - await TryHandleProxy(evt, ctx); + if (await TryHandleLogClean(evt, ctx)) + return; + + // Only do command/proxy handling if it's a user account + if (evt.Message.Author.IsBot || evt.Message.WebhookMessage || evt.Message.Author.IsSystem == true) + return; + if (await TryHandleCommand(evt, ctx)) + return; + await TryHandleProxy(evt, ctx); } private async ValueTask TryHandleLogClean(MessageCreateEventArgs evt, MessageContext ctx)