From 74619a4434051eb319fc76e41dc8f7e082b14007 Mon Sep 17 00:00:00 2001 From: runebaas Date: Sun, 26 Aug 2018 17:54:26 +0200 Subject: [PATCH] Solve casting issue --- Geekbot.net/Handlers.cs | 2 +- Geekbot.net/Lib/Logger/SimpleConextConverter.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Geekbot.net/Handlers.cs b/Geekbot.net/Handlers.cs index 64b3a15..0e57d55 100644 --- a/Geekbot.net/Handlers.cs +++ b/Geekbot.net/Handlers.cs @@ -99,7 +99,7 @@ namespace Geekbot.net if (message == null) return; if (message.Channel.Name.StartsWith('@')) { - _logger.Information(LogSource.Message, $"[DM-Channel] {message.Content}", SimpleConextConverter.ConvertSocketMessage(message)); + _logger.Information(LogSource.Message, $"[DM-Channel] {message.Content}", SimpleConextConverter.ConvertSocketMessage(message, true)); return; } diff --git a/Geekbot.net/Lib/Logger/SimpleConextConverter.cs b/Geekbot.net/Lib/Logger/SimpleConextConverter.cs index 0845cc1..5659896 100644 --- a/Geekbot.net/Lib/Logger/SimpleConextConverter.cs +++ b/Geekbot.net/Lib/Logger/SimpleConextConverter.cs @@ -35,9 +35,9 @@ namespace Geekbot.net.Lib.Logger } }; } - public static MessageDto ConvertSocketMessage(SocketMessage message) + public static MessageDto ConvertSocketMessage(SocketMessage message, bool isPrivate = false) { - var channel = (SocketGuildChannel) message.Channel; + SocketGuildChannel channel = isPrivate ? null : (SocketGuildChannel) message.Channel; return new MessageDto { Message = new MessageDto.MessageContent