diff --git a/src/Responders/MessageEditedResponder.cs b/src/Responders/MessageEditedResponder.cs index d4455c0..c7426d2 100644 --- a/src/Responders/MessageEditedResponder.cs +++ b/src/Responders/MessageEditedResponder.cs @@ -36,18 +36,22 @@ public class MessageEditedResponder : IResponder public async Task RespondAsync(IMessageUpdate gatewayEvent, CancellationToken ct = default) { + if (!gatewayEvent.ID.IsDefined(out var messageId)) + { + return new ArgumentNullError(nameof(gatewayEvent.ID)); + } + + if (!gatewayEvent.ChannelID.IsDefined(out var channelId)) + { + return new ArgumentNullError(nameof(gatewayEvent.ChannelID)); + } + if (!gatewayEvent.GuildID.IsDefined(out var guildId)) { return Result.FromSuccess(); } - var cfg = await _guildData.GetSettings(guildId, ct); - if (GuildSettings.PrivateFeedbackChannel.Get(cfg).Empty()) - { - return Result.FromSuccess(); - } - - if (!gatewayEvent.Content.IsDefined(out var newContent)) + if (gatewayEvent.Author.IsDefined(out var author) && author.IsBot.OrDefault(false)) { return Result.FromSuccess(); } @@ -57,17 +61,13 @@ public class MessageEditedResponder : IResponder return Result.FromSuccess(); // The message wasn't actually edited } - if (!gatewayEvent.ChannelID.IsDefined(out var channelId)) + if (!gatewayEvent.Content.IsDefined(out var newContent)) { - return new ArgumentNullError(nameof(gatewayEvent.ChannelID)); + return Result.FromSuccess(); } - if (!gatewayEvent.ID.IsDefined(out var messageId)) - { - return new ArgumentNullError(nameof(gatewayEvent.ID)); - } - - if (gatewayEvent.Author.IsDefined(out var author) && author.IsBot.OrDefault(false)) + var cfg = await _guildData.GetSettings(guildId, ct); + if (GuildSettings.PrivateFeedbackChannel.Get(cfg).Empty()) { return Result.FromSuccess(); }