From 14c0b44f03a68bc0861e4ba31f3f69cc97659977 Mon Sep 17 00:00:00 2001 From: Kwoth Date: Tue, 21 Feb 2017 03:27:30 +0100 Subject: [PATCH] fixed message deleted and message updated with image uploads or embeds --- .../Modules/Administration/Commands/LogCommand.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/NadekoBot/Modules/Administration/Commands/LogCommand.cs b/src/NadekoBot/Modules/Administration/Commands/LogCommand.cs index 88d512e7..b6b4967b 100644 --- a/src/NadekoBot/Modules/Administration/Commands/LogCommand.cs +++ b/src/NadekoBot/Modules/Administration/Commands/LogCommand.cs @@ -705,8 +705,8 @@ namespace NadekoBot.Modules.Administration var embed = new EmbedBuilder() .WithOkColor() .WithTitle("🗑 " + logChannel.Guild.GetLogText("msg_del", ((ITextChannel)msg.Channel).Name)) - .WithDescription($"{msg.Author}") - .AddField(efb => efb.WithName(logChannel.Guild.GetLogText("content")).WithValue(msg.Resolve(userHandling: TagHandling.FullName)).WithIsInline(false)) + .WithDescription(msg.Author.ToString()) + .AddField(efb => efb.WithName(logChannel.Guild.GetLogText("content")).WithValue(string.IsNullOrWhiteSpace(msg.Content) ? "-" : msg.Resolve(userHandling: TagHandling.FullName)).WithIsInline(false)) .AddField(efb => efb.WithName("Id").WithValue(msg.Id.ToString()).WithIsInline(false)) .WithFooter(efb => efb.WithText(currentTime)); if (msg.Attachments.Any()) @@ -714,8 +714,9 @@ namespace NadekoBot.Modules.Administration await logChannel.EmbedAsync(embed).ConfigureAwait(false); } - catch + catch (Exception ex) { + _log.Warn(ex); // ignored } } @@ -753,8 +754,8 @@ namespace NadekoBot.Modules.Administration .WithOkColor() .WithTitle("📝 " + logChannel.Guild.GetLogText("msg_update", ((ITextChannel)after.Channel).Name)) .WithDescription(after.Author.ToString()) - .AddField(efb => efb.WithName(logChannel.Guild.GetLogText("old_msg")).WithValue(before.Resolve(userHandling: TagHandling.FullName)).WithIsInline(false)) - .AddField(efb => efb.WithName(logChannel.Guild.GetLogText("new_msg")).WithValue(after.Resolve(userHandling: TagHandling.FullName)).WithIsInline(false)) + .AddField(efb => efb.WithName(logChannel.Guild.GetLogText("old_msg")).WithValue(string.IsNullOrWhiteSpace(before.Content) ? "-" : before.Resolve(userHandling: TagHandling.FullName)).WithIsInline(false)) + .AddField(efb => efb.WithName(logChannel.Guild.GetLogText("new_msg")).WithValue(string.IsNullOrWhiteSpace(after.Content) ? "-" : after.Resolve(userHandling: TagHandling.FullName)).WithIsInline(false)) .AddField(efb => efb.WithName("Id").WithValue(after.Id.ToString()).WithIsInline(false)) .WithFooter(efb => efb.WithText(currentTime));