Revert SimpleContextConverter

This commit is contained in:
Runebaas 2018-02-20 09:34:26 +01:00
parent a616d42543
commit e158e2196f
No known key found for this signature in database
GPG key ID: 2677AF508D0300D6

View file

@ -8,7 +8,33 @@ namespace Geekbot.net.Lib
{ {
public static MessageDto ConvertContext(ICommandContext context) public static MessageDto ConvertContext(ICommandContext context)
{ {
return ConvertSocketMessage((SocketMessage) context.Message); return new MessageDto()
{
Message = new MessageDto.MessageContent()
{
Content = context.Message.Content,
Id = context.Message.Id.ToString(),
Attachments = context.Message.Attachments.Count,
ChannelMentions = context.Message.MentionedChannelIds.Count,
UserMentions = context.Message.MentionedUserIds.Count,
RoleMentions = context.Message.MentionedRoleIds.Count
},
User = new MessageDto.IdAndName()
{
Id = context.User.Id.ToString(),
Name = $"{context.User.Username}#{context.User.Discriminator}"
},
Guild = new MessageDto.IdAndName()
{
Id = context.Guild.Id.ToString(),
Name = context.Guild.Name
},
Channel = new MessageDto.IdAndName()
{
Id = context.Channel.Id.ToString(),
Name = context.Channel.Name
}
};
} }
public static MessageDto ConvertSocketMessage(SocketMessage message) public static MessageDto ConvertSocketMessage(SocketMessage message)
{ {