| @@ -223,6 +223,8 @@ namespace Discord | |||||
| if (count < 0) throw new ArgumentNullException(nameof(count)); | if (count < 0) throw new ArgumentNullException(nameof(count)); | ||||
| CheckReady(); | CheckReady(); | ||||
| bool trackActivity = Config.TrackActivity; | |||||
| if (count == 0) return new Message[0]; | if (count == 0) return new Message[0]; | ||||
| if (channel != null && channel.Type == ChannelType.Text) | if (channel != null && channel.Type == ChannelType.Text) | ||||
| { | { | ||||
| @@ -233,21 +235,20 @@ namespace Discord | |||||
| { | { | ||||
| Message msg = null; | Message msg = null; | ||||
| if (cache) | if (cache) | ||||
| msg = _messages.GetOrAdd(x.Id, x.ChannelId, x.Author.Id); | |||||
| else | |||||
| { | |||||
| msg = _messages[x.Id] ?? new Message(this, x.Id, x.ChannelId, x.Author.Id); | |||||
| msg.Update(x); //TODO: Look into updating when cache is true, but only if we actually generated a new message. | |||||
| } | |||||
| if (Config.TrackActivity) | |||||
| { | { | ||||
| if (!channel.IsPrivate) | |||||
| msg = _messages.GetOrAdd(x.Id, x.ChannelId, x.Author.Id); | |||||
| if (trackActivity) | |||||
| { | { | ||||
| 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 | |||||
| { | |||||
| msg = /*_messages[x.Id] ??*/ new Message(this, x.Id, x.ChannelId, x.Author.Id); | |||||
| msg.Update(x); | |||||
| } | |||||
| return msg; | return msg; | ||||
| }) | }) | ||||
| .ToArray(); | .ToArray(); | ||||