|
@@ -275,7 +275,7 @@ namespace Discord |
|
|
if (_messages.TryGetValue(id, out result)) |
|
|
if (_messages.TryGetValue(id, out result)) |
|
|
return result; |
|
|
return result; |
|
|
} |
|
|
} |
|
|
return new Message(id, this, userId != null ? GetUser(userId.Value) : null); |
|
|
|
|
|
|
|
|
return new Message(id, this, userId != null ? GetUserFast(userId.Value) : null); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public async Task<Message[]> DownloadMessages(int limit = 100, ulong? relativeMessageId = null, |
|
|
public async Task<Message[]> DownloadMessages(int limit = 100, ulong? relativeMessageId = null, |
|
@@ -298,13 +298,13 @@ namespace Discord |
|
|
Message msg = null; |
|
|
Message msg = null; |
|
|
if (useCache) |
|
|
if (useCache) |
|
|
{ |
|
|
{ |
|
|
msg = AddMessage(x.Id, GetUser(x.Author.Id), x.Timestamp.Value); |
|
|
|
|
|
|
|
|
msg = AddMessage(x.Id, GetUserFast(x.Author.Id), x.Timestamp.Value); |
|
|
var user = msg.User; |
|
|
var user = msg.User; |
|
|
if (user != null) |
|
|
if (user != null) |
|
|
user.UpdateActivity(msg.EditedTimestamp ?? msg.Timestamp); |
|
|
user.UpdateActivity(msg.EditedTimestamp ?? msg.Timestamp); |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
msg = new Message(x.Id, this, GetUser(x.Author.Id)); |
|
|
|
|
|
|
|
|
msg = new Message(x.Id, this, GetUserFast(x.Author.Id)); |
|
|
msg.Update(x); |
|
|
msg.Update(x); |
|
|
return msg; |
|
|
return msg; |
|
|
}) |
|
|
}) |
|
@@ -573,6 +573,20 @@ namespace Discord |
|
|
} |
|
|
} |
|
|
return null; |
|
|
return null; |
|
|
} |
|
|
} |
|
|
|
|
|
internal User GetUserFast(ulong id) |
|
|
|
|
|
{ |
|
|
|
|
|
//Can return users not in this channel, but that's usually okay |
|
|
|
|
|
if (IsPrivate) |
|
|
|
|
|
{ |
|
|
|
|
|
if (id == Recipient.Id) |
|
|
|
|
|
return Recipient; |
|
|
|
|
|
else if (id == Client.PrivateUser.Id) |
|
|
|
|
|
return Client.PrivateUser; |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
return Server.GetUser(id); |
|
|
|
|
|
return null; |
|
|
|
|
|
} |
|
|
#endregion |
|
|
#endregion |
|
|
|
|
|
|
|
|
internal Channel Clone() |
|
|
internal Channel Clone() |
|
|