Removed trackactivity conditionals
This commit is contained in:
@@ -275,9 +275,7 @@ namespace Discord
|
|||||||
if (channel == null) throw new ArgumentNullException(nameof(channel));
|
if (channel == null) throw new ArgumentNullException(nameof(channel));
|
||||||
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)
|
||||||
{
|
{
|
||||||
@@ -290,12 +288,9 @@ namespace Discord
|
|||||||
if (useCache)
|
if (useCache)
|
||||||
{
|
{
|
||||||
msg = _messages.GetOrAdd(x.Id, x.ChannelId, x.Author.Id);
|
msg = _messages.GetOrAdd(x.Id, x.ChannelId, x.Author.Id);
|
||||||
if (trackActivity)
|
var user = msg.User;
|
||||||
{
|
if (user != null)
|
||||||
var user = msg.User;
|
user.UpdateActivity(msg.EditedTimestamp ?? msg.Timestamp);
|
||||||
if (user != null)
|
|
||||||
user.UpdateActivity(msg.EditedTimestamp ?? msg.Timestamp);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
msg = /*_messages[x.Id] ??*/ new Message(this, x.Id, x.ChannelId, x.Author.Id);
|
msg = /*_messages[x.Id] ??*/ new Message(this, x.Id, x.ChannelId, x.Author.Id);
|
||||||
@@ -338,6 +333,12 @@ namespace Discord
|
|||||||
})
|
})
|
||||||
.ToDictionary(x => x.Id);
|
.ToDictionary(x => x.Id);
|
||||||
_messages.Import(dic);
|
_messages.Import(dic);
|
||||||
|
foreach (var msg in dic.Values)
|
||||||
|
{
|
||||||
|
var user = msg.User;
|
||||||
|
if (user != null)
|
||||||
|
user.UpdateActivity(msg.EditedTimestamp ?? msg.Timestamp);
|
||||||
|
}
|
||||||
return dic.Values;
|
return dic.Values;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ namespace Discord
|
|||||||
RaiseDisconnected(e);
|
RaiseDisconnected(e);
|
||||||
};
|
};
|
||||||
|
|
||||||
_webSocket.ReceivedDispatch += async (s, e) => await OnReceivedEvent(e).ConfigureAwait(false);
|
_webSocket.ReceivedDispatch += (s, e) => OnReceivedEvent(e);
|
||||||
|
|
||||||
_api = new DiscordAPIClient(_config);
|
_api = new DiscordAPIClient(_config);
|
||||||
if (Config.UseMessageQueue)
|
if (Config.UseMessageQueue)
|
||||||
@@ -419,7 +419,7 @@ namespace Discord
|
|||||||
_privateUser = null;
|
_privateUser = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task OnReceivedEvent(WebSocketEventEventArgs e)
|
private void OnReceivedEvent(WebSocketEventEventArgs e)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -533,8 +533,7 @@ namespace Discord
|
|||||||
var data = e.Payload.ToObject<MemberAddEvent>(_webSocket.Serializer);
|
var data = e.Payload.ToObject<MemberAddEvent>(_webSocket.Serializer);
|
||||||
var user = _users.GetOrAdd(data.User.Id, data.GuildId);
|
var user = _users.GetOrAdd(data.User.Id, data.GuildId);
|
||||||
user.Update(data);
|
user.Update(data);
|
||||||
if (Config.TrackActivity)
|
user.UpdateActivity();
|
||||||
user.UpdateActivity();
|
|
||||||
RaiseUserJoined(user);
|
RaiseUserJoined(user);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -653,16 +652,9 @@ namespace Discord
|
|||||||
}
|
}
|
||||||
|
|
||||||
msg.Update(data);
|
msg.Update(data);
|
||||||
if (Config.TrackActivity)
|
var user = msg.User;
|
||||||
{
|
if (user != null)
|
||||||
var channel = msg.Channel;
|
user.UpdateActivity();// data.Timestamp);
|
||||||
if (channel?.IsPrivate == false)
|
|
||||||
{
|
|
||||||
var user = msg.User;
|
|
||||||
if (user != null)
|
|
||||||
user.UpdateActivity(data.Timestamp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Remapped queued message
|
//Remapped queued message
|
||||||
if (nonce != 0)
|
if (nonce != 0)
|
||||||
@@ -726,18 +718,10 @@ namespace Discord
|
|||||||
if (user != null)
|
if (user != null)
|
||||||
{
|
{
|
||||||
if (channel != null)
|
if (channel != null)
|
||||||
RaiseUserIsTyping(user, channel);
|
RaiseUserIsTyping(user, channel);
|
||||||
}
|
user.UpdateActivity();
|
||||||
|
}
|
||||||
if (Config.TrackActivity)
|
}
|
||||||
{
|
|
||||||
if (!channel.IsPrivate)
|
|
||||||
{
|
|
||||||
if (user != null)
|
|
||||||
user.UpdateActivity();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user