mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-12 01:23:31 +01:00
Emit -ed and fixed presence vs. userUpdated check
This commit is contained in:
@@ -1556,14 +1556,14 @@ var InternalClient = (function () {
|
||||
|
||||
var presenceUser = new User(data.user, client);
|
||||
|
||||
if (presenceUser.equalsStrict(user)) {
|
||||
if (presenceUser.equals(user)) {
|
||||
// a real presence update
|
||||
client.emit("presence", user, data.status, data.game_id);
|
||||
user.status = data.status;
|
||||
user.gameID = data.game_id;
|
||||
} else {
|
||||
// a name change or avatar change
|
||||
client.emit("userUpdate", user, presenceUser);
|
||||
client.emit("userUpdated", user, presenceUser);
|
||||
self.users.update(user, presenceUser);
|
||||
}
|
||||
} else {
|
||||
@@ -1583,14 +1583,14 @@ var InternalClient = (function () {
|
||||
} else {
|
||||
user.typing.since = Date.now();
|
||||
user.typing.channel = channel;
|
||||
client.emit("userTypingStart", user, channel);
|
||||
client.emit("userTypingStarted", user, channel);
|
||||
}
|
||||
setTimeout(function () {
|
||||
if (Date.now() - user.typing.since > 5500) {
|
||||
// they haven't typed since
|
||||
user.typing.since = null;
|
||||
user.typing.channel = null;
|
||||
client.emit("userTypingStop", user, channel);
|
||||
client.emit("userTypingStopped", user, channel);
|
||||
}
|
||||
}, 6000);
|
||||
} else {
|
||||
@@ -1631,4 +1631,4 @@ var InternalClient = (function () {
|
||||
return InternalClient;
|
||||
})();
|
||||
|
||||
module.exports = InternalClient;
|
||||
module.exports = InternalClient;
|
||||
|
||||
Reference in New Issue
Block a user