Fixed a few reference bugs with private messages
This commit is contained in:
@@ -32,7 +32,7 @@ namespace Discord
|
||||
if (v == null && _id != null)
|
||||
{
|
||||
v = _getItem(_id);
|
||||
if (v != null)
|
||||
if (v != null && _onCache != null)
|
||||
_onCache(v);
|
||||
_value = v;
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ namespace Discord
|
||||
x => x.AddChannel(this),
|
||||
x => x.RemoveChannel(this));
|
||||
_recipient = new Reference<User>(recipientId,
|
||||
x => _client.Users[x, _server.Id],
|
||||
x => _client.Users.GetOrAdd(x, _server.Id),
|
||||
x =>
|
||||
{
|
||||
Name = "@" + x.Name;
|
||||
|
||||
@@ -145,8 +145,19 @@ namespace Discord
|
||||
internal Message(DiscordClient client, string id, string channelId, string userId)
|
||||
: base(client, id)
|
||||
{
|
||||
_channel = new Reference<Channel>(channelId, x => _client.Channels[x], x => x.AddMessage(this), x => x.RemoveMessage(this));
|
||||
_user = new Reference<User>(userId, x => _client.Users[x]);
|
||||
_channel = new Reference<Channel>(channelId,
|
||||
x => _client.Channels[x],
|
||||
x => x.AddMessage(this),
|
||||
x => x.RemoveMessage(this));
|
||||
_user = new Reference<User>(userId,
|
||||
x =>
|
||||
{
|
||||
var channel = Channel;
|
||||
if (!channel.IsPrivate)
|
||||
return _client.Users[x, channel.Server.Id];
|
||||
else
|
||||
return _client.Users[x, null];
|
||||
});
|
||||
Attachments = _initialAttachments;
|
||||
Embeds = _initialEmbeds;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user