From 55a056d96fd2858e3af7aeb26aa13227cd53d777 Mon Sep 17 00:00:00 2001 From: Master Kwoth Date: Mon, 30 May 2016 19:47:35 +0200 Subject: [PATCH] logserver now shows image uploads --- .../Administration/Commands/LogCommand.cs | 27 ++++++++++++++++--- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/NadekoBot/Modules/Administration/Commands/LogCommand.cs b/NadekoBot/Modules/Administration/Commands/LogCommand.cs index 381f5511..ad020ba4 100644 --- a/NadekoBot/Modules/Administration/Commands/LogCommand.cs +++ b/NadekoBot/Modules/Administration/Commands/LogCommand.cs @@ -166,9 +166,19 @@ namespace NadekoBot.Modules.Administration.Commands Channel ch; if (!logs.TryGetValue(e.Server, out ch) || e.Channel == ch) return; - await ch.SendMessage( -$@"🕔`{prettyCurrentTime}` **New Message** `#{e.Channel.Name}` + if (!string.IsNullOrWhiteSpace(e.Message.Text)) + { + await ch.SendMessage( + $@"🕔`{prettyCurrentTime}` **New Message** `#{e.Channel.Name}` 👤`{e.User?.ToString() ?? ("NULL")}` {e.Message.Text.Unmention()}").ConfigureAwait(false); + } + else + { + await ch.SendMessage( + $@"🕔`{prettyCurrentTime}` **File Uploaded** `#{e.Channel.Name}` +👤`{e.User?.ToString() ?? ("NULL")}` {e.Message.Attachments.FirstOrDefault()?.ProxyUrl}").ConfigureAwait(false); + } + } catch { } } @@ -181,9 +191,18 @@ $@"🕔`{prettyCurrentTime}` **New Message** `#{e.Channel.Name}` Channel ch; if (!logs.TryGetValue(e.Server, out ch) || e.Channel == ch) return; - await ch.SendMessage( -$@"🕔`{prettyCurrentTime}` **Message** 🚮 `#{e.Channel.Name}` + if (!string.IsNullOrWhiteSpace(e.Message.Text)) + { + await ch.SendMessage( + $@"🕔`{prettyCurrentTime}` **Message** 🚮 `#{e.Channel.Name}` 👤`{e.User?.ToString() ?? ("NULL")}` {e.Message.Text.Unmention()}").ConfigureAwait(false); + } + else + { + await ch.SendMessage( + $@"🕔`{prettyCurrentTime}` **File Deleted** `#{e.Channel.Name}` +👤`{e.User?.ToString() ?? ("NULL")}` {e.Message.Attachments.FirstOrDefault()?.ProxyUrl}").ConfigureAwait(false); + } } catch { } }