fixed some logcommand errors

This commit is contained in:
Master Kwoth 2016-05-03 05:55:26 +02:00
parent e10b19e533
commit 0e4ae5d1bb

View File

@ -87,12 +87,12 @@ namespace NadekoBot.Modules.Administration.Commands
{ {
try try
{ {
if (e.Server == null || e.Channel.IsPrivate || e.User.Id == NadekoBot.Client.CurrentUser.Id) if (e.Server == null || e.Channel.IsPrivate || e.User?.Id == NadekoBot.Client.CurrentUser.Id)
return; return;
Channel ch; Channel ch;
if (!logs.TryGetValue(e.Server, out ch) || e.Channel == ch) if (!logs.TryGetValue(e.Server, out ch) || e.Channel == ch)
return; return;
await ch.SendMessage($"`Type:` **Message deleted** `Time:` **{DateTime.Now}** `Channel:` **{e.Channel.Name}**\n`{e.User}:` {e.Message.Text}").ConfigureAwait(false); await ch.SendMessage($"`Type:` **Message deleted** `Time:` **{DateTime.Now}** `Channel:` **{e.Channel.Name}**\n`{e.User?.ToString() ?? ("NULL") }:` {e.Message.Text}").ConfigureAwait(false);
} }
catch { } catch { }
} }
@ -100,12 +100,12 @@ namespace NadekoBot.Modules.Administration.Commands
{ {
try try
{ {
if (e.Server == null || e.Channel.IsPrivate || e.User.Id == NadekoBot.Client.CurrentUser.Id) if (e.Server == null || e.Channel.IsPrivate || e.User?.Id == NadekoBot.Client.CurrentUser.Id)
return; return;
Channel ch; Channel ch;
if (!logs.TryGetValue(e.Server, out ch) || e.Channel == ch) if (!logs.TryGetValue(e.Server, out ch) || e.Channel == ch)
return; return;
await ch.SendMessage($"`Type:` **Message updated** `Time:` **{DateTime.Now}** `Channel:` **{e.Channel.Name}**\n**BEFORE**: `{e.User}:` {e.Before.Text}\n---------------\n**AFTER**: `{e.User}:` {e.After.Text}").ConfigureAwait(false); await ch.SendMessage($"`Type:` **Message updated** `Time:` **{DateTime.Now}** `Channel:` **{e.Channel.Name}**\n**BEFORE**: `{e.User?.ToString() ?? ("NULL")}:` {e.Before.Text}\n---------------\n**AFTER**: `{e.User}:` {e.After.Text}").ConfigureAwait(false);
} }
catch { } catch { }
} }