Fixed null author when downloading messages for an uncached user

This commit is contained in:
RogueException
2016-06-12 21:00:26 -03:00
parent 9c1e20dda8
commit d2d8a689ce

View File

@@ -116,7 +116,11 @@ namespace Discord
RelativeMessageId = relativeId
};
var downloadedMessages = await _discord.ApiClient.GetChannelMessagesAsync(_channel.Id, args).ConfigureAwait(false);
return cachedMessages.Concat(downloadedMessages.Select(x => new CachedMessage(_channel, _channel.GetUser(x.Id), x))).ToImmutableArray();
return cachedMessages.Concat(downloadedMessages.Select(x =>
{
var user = _channel.GetUser(x.Id) ?? new User(_channel.Discord, x.Author.Value) as IUser;
return new CachedMessage(_channel, user, x);
})).ToImmutableArray();
}
}
}