mirror of
https://github.com/danbulant/discord.js
synced 2026-06-06 08:11:50 +00:00
store gameId on user object
This commit is contained in:
parent
3578178941
commit
0c5caefa9f
16 changed files with 24 additions and 16 deletions
|
|
@ -179,4 +179,4 @@ var ChannelPermissions = (function () {
|
||||||
return ChannelPermissions;
|
return ChannelPermissions;
|
||||||
})();
|
})();
|
||||||
|
|
||||||
module.exports = ChannelPermissions;
|
module.exports = ChannelPermissions;
|
||||||
|
|
|
||||||
|
|
@ -1091,6 +1091,7 @@ var Client = (function () {
|
||||||
gameId: data.game_id
|
gameId: data.game_id
|
||||||
});
|
});
|
||||||
userInCache.status = data.status;
|
userInCache.status = data.status;
|
||||||
|
userInCache.gameId = data.game_id;
|
||||||
} else {
|
} else {
|
||||||
//one of their details changed.
|
//one of their details changed.
|
||||||
self.userCache[self.userCache.indexOf(userInCache)] = presenceUser;
|
self.userCache[self.userCache.indexOf(userInCache)] = presenceUser;
|
||||||
|
|
@ -1288,7 +1289,9 @@ var Client = (function () {
|
||||||
for (var _iterator9 = data.presences[Symbol.iterator](), _step9; !(_iteratorNormalCompletion9 = (_step9 = _iterator9.next()).done); _iteratorNormalCompletion9 = true) {
|
for (var _iterator9 = data.presences[Symbol.iterator](), _step9; !(_iteratorNormalCompletion9 = (_step9 = _iterator9.next()).done); _iteratorNormalCompletion9 = true) {
|
||||||
var presence = _step9.value;
|
var presence = _step9.value;
|
||||||
|
|
||||||
self.getUser("id", presence.user.id).status = presence.status;
|
var user = self.getUser("id", presence.user.id);
|
||||||
|
user.status = presence.status;
|
||||||
|
user.gameId = presence.game_id;
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
_didIteratorError9 = true;
|
_didIteratorError9 = true;
|
||||||
|
|
@ -1864,4 +1867,4 @@ var Client = (function () {
|
||||||
return Client;
|
return Client;
|
||||||
})();
|
})();
|
||||||
|
|
||||||
module.exports = Client;
|
module.exports = Client;
|
||||||
|
|
|
||||||
|
|
@ -10,4 +10,4 @@ exports.LOGIN = exports.AUTH + "/login";
|
||||||
exports.LOGOUT = exports.AUTH + "/logout";
|
exports.LOGOUT = exports.AUTH + "/logout";
|
||||||
exports.USERS = exports.API + "/users";
|
exports.USERS = exports.API + "/users";
|
||||||
exports.SERVERS = exports.API + "/guilds";
|
exports.SERVERS = exports.API + "/guilds";
|
||||||
exports.CHANNELS = exports.API + "/channels";
|
exports.CHANNELS = exports.API + "/channels";
|
||||||
|
|
|
||||||
|
|
@ -169,4 +169,4 @@ var EvaluatedPermissions = (function () {
|
||||||
return EvaluatedPermissions;
|
return EvaluatedPermissions;
|
||||||
})();
|
})();
|
||||||
|
|
||||||
module.exports = EvaluatedPermissions;
|
module.exports = EvaluatedPermissions;
|
||||||
|
|
|
||||||
|
|
@ -222,4 +222,4 @@ var Member = (function (_User) {
|
||||||
return Member;
|
return Member;
|
||||||
})(User);
|
})(User);
|
||||||
|
|
||||||
module.exports = Member;
|
module.exports = Member;
|
||||||
|
|
|
||||||
|
|
@ -69,4 +69,4 @@ var PMChannel = (function () {
|
||||||
return PMChannel;
|
return PMChannel;
|
||||||
})();
|
})();
|
||||||
|
|
||||||
module.exports = PMChannel;
|
module.exports = PMChannel;
|
||||||
|
|
|
||||||
|
|
@ -199,4 +199,4 @@ var ServerPermissions = (function () {
|
||||||
return ServerPermissions;
|
return ServerPermissions;
|
||||||
})();
|
})();
|
||||||
|
|
||||||
module.exports = ServerPermissions;
|
module.exports = ServerPermissions;
|
||||||
|
|
|
||||||
|
|
@ -149,4 +149,4 @@ var Channel = (function () {
|
||||||
return Channel;
|
return Channel;
|
||||||
})();
|
})();
|
||||||
|
|
||||||
module.exports = Channel;
|
module.exports = Channel;
|
||||||
|
|
|
||||||
|
|
@ -9,4 +9,4 @@ var Discord = {
|
||||||
Client: Client
|
Client: Client
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = Discord;
|
module.exports = Discord;
|
||||||
|
|
|
||||||
|
|
@ -200,4 +200,4 @@ Internal.XHR.setUsername = function (token, avatar, email, newPassword, password
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.Internal = Internal;
|
exports.Internal = Internal;
|
||||||
|
|
|
||||||
|
|
@ -32,4 +32,4 @@ var Invite = (function () {
|
||||||
return Invite;
|
return Invite;
|
||||||
})();
|
})();
|
||||||
|
|
||||||
module.exports = Invite;
|
module.exports = Invite;
|
||||||
|
|
|
||||||
|
|
@ -82,4 +82,4 @@ var Message = (function () {
|
||||||
return Message;
|
return Message;
|
||||||
})();
|
})();
|
||||||
|
|
||||||
module.exports = Message;
|
module.exports = Message;
|
||||||
|
|
|
||||||
|
|
@ -341,4 +341,4 @@ var Server = (function () {
|
||||||
return Server;
|
return Server;
|
||||||
})();
|
})();
|
||||||
|
|
||||||
module.exports = Server;
|
module.exports = Server;
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ var User = (function () {
|
||||||
this.id = data.id;
|
this.id = data.id;
|
||||||
this.avatar = data.avatar;
|
this.avatar = data.avatar;
|
||||||
this.status = data.status || "offline";
|
this.status = data.status || "offline";
|
||||||
|
this.gameId = data.game_id || null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// access using user.avatarURL;
|
// access using user.avatarURL;
|
||||||
|
|
@ -54,4 +55,4 @@ var User = (function () {
|
||||||
return User;
|
return User;
|
||||||
})();
|
})();
|
||||||
|
|
||||||
module.exports = User;
|
module.exports = User;
|
||||||
|
|
|
||||||
|
|
@ -1000,6 +1000,7 @@ class Client {
|
||||||
gameId: data.game_id
|
gameId: data.game_id
|
||||||
});
|
});
|
||||||
userInCache.status = data.status;
|
userInCache.status = data.status;
|
||||||
|
userInCache.gameId = data.game_id;
|
||||||
} else {
|
} else {
|
||||||
//one of their details changed.
|
//one of their details changed.
|
||||||
self.userCache[self.userCache.indexOf(userInCache)] = presenceUser;
|
self.userCache[self.userCache.indexOf(userInCache)] = presenceUser;
|
||||||
|
|
@ -1168,7 +1169,9 @@ class Client {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var presence of data.presences) {
|
for (var presence of data.presences) {
|
||||||
self.getUser("id", presence.user.id).status = presence.status;
|
var user = self.getUser("id", presence.user.id);
|
||||||
|
user.status = presence.status;
|
||||||
|
user.gameId = presence.game_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
return server;
|
return server;
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ class User{
|
||||||
this.id = data.id;
|
this.id = data.id;
|
||||||
this.avatar = data.avatar;
|
this.avatar = data.avatar;
|
||||||
this.status = data.status || "offline";
|
this.status = data.status || "offline";
|
||||||
|
this.gameId = data.game_id || null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// access using user.avatarURL;
|
// access using user.avatarURL;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue