From 7e43b75f97217328936b3c3670f77dfc6588f013 Mon Sep 17 00:00:00 2001 From: Ske Date: Fri, 1 May 2020 15:41:37 +0200 Subject: [PATCH] Fix errors on eg. incoming link embed update events --- PluralKit.Bot/Bot.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/PluralKit.Bot/Bot.cs b/PluralKit.Bot/Bot.cs index bde58fe5..2966588f 100644 --- a/PluralKit.Bot/Bot.cs +++ b/PluralKit.Bot/Bot.cs @@ -424,6 +424,12 @@ namespace PluralKit.Bot public async Task HandleMessageEdited(MessageUpdateEventArgs args) { + // Sometimes edit message events arrive for other reasons (eg. an embed gets updated server-side) + // If this wasn't a *content change* (ie. there's message contents to read), bail + // It'll also sometimes arrive with no *author*, so we'll go ahead and ignore those messages too + if (args.Message.Content == null) return; + if (args.Author == null) return; + _sentryScope.AddBreadcrumb(args.Message.Content ?? "", "event.messageEdit", data: new Dictionary() { {"channel", args.Channel.Id.ToString()},