Solve casting issue

This commit is contained in:
runebaas 2018-08-26 17:54:26 +02:00
parent 00da991dae
commit 74619a4434
No known key found for this signature in database
GPG key ID: 2677AF508D0300D6
2 changed files with 3 additions and 3 deletions

View file

@ -99,7 +99,7 @@ namespace Geekbot.net
if (message == null) return; if (message == null) return;
if (message.Channel.Name.StartsWith('@')) 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; return;
} }

View file

@ -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 return new MessageDto
{ {
Message = new MessageDto.MessageContent Message = new MessageDto.MessageContent