diff --git a/lib/Client/Client.js b/lib/Client/Client.js index 3d407da7..5bf5fb03 100644 --- a/lib/Client/Client.js +++ b/lib/Client/Client.js @@ -933,4 +933,4 @@ var Client = (function (_EventEmitter) { return Client; })(EventEmitter); -module.exports = Client; \ No newline at end of file +module.exports = Client; diff --git a/lib/Client/ConnectionState.js b/lib/Client/ConnectionState.js index 86fb9526..e0585d77 100644 --- a/lib/Client/ConnectionState.js +++ b/lib/Client/ConnectionState.js @@ -4,4 +4,4 @@ exports.IDLE = 0; exports.LOGGING_IN = 1; exports.LOGGED_IN = 2; exports.READY = 3; -exports.DISCONNECTED = 4; \ No newline at end of file +exports.DISCONNECTED = 4; diff --git a/lib/Client/InternalClient.js b/lib/Client/InternalClient.js index e3673eb1..4d9e5c9f 100644 --- a/lib/Client/InternalClient.js +++ b/lib/Client/InternalClient.js @@ -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; \ No newline at end of file +module.exports = InternalClient; diff --git a/lib/Client/Resolver/Resolver.js b/lib/Client/Resolver/Resolver.js index ed23d92f..b6edf95d 100644 --- a/lib/Client/Resolver/Resolver.js +++ b/lib/Client/Resolver/Resolver.js @@ -236,4 +236,4 @@ var Resolver = (function () { return Resolver; })(); -module.exports = Resolver; \ No newline at end of file +module.exports = Resolver; diff --git a/lib/Constants.js b/lib/Constants.js index 572f3c8f..bd03f326 100644 --- a/lib/Constants.js +++ b/lib/Constants.js @@ -127,4 +127,4 @@ var PacketType = { exports.API_ENDPOINT = API; exports.Endpoints = Endpoints; exports.PacketType = PacketType; -exports.Permissions = Permissions; \ No newline at end of file +exports.Permissions = Permissions; diff --git a/lib/Structures/Channel.js b/lib/Structures/Channel.js index 93d222f1..395c1455 100644 --- a/lib/Structures/Channel.js +++ b/lib/Structures/Channel.js @@ -36,4 +36,4 @@ var Channel = (function (_Equality) { return Channel; })(Equality); -module.exports = Channel; \ No newline at end of file +module.exports = Channel; diff --git a/lib/Structures/ChannelPermissions.js b/lib/Structures/ChannelPermissions.js index fe7a039f..0c1b29e9 100644 --- a/lib/Structures/ChannelPermissions.js +++ b/lib/Structures/ChannelPermissions.js @@ -72,4 +72,4 @@ var ChannelPermissions = (function () { return ChannelPermissions; })(); -module.exports = ChannelPermissions; \ No newline at end of file +module.exports = ChannelPermissions; diff --git a/lib/Structures/Invite.js b/lib/Structures/Invite.js index 04a125d2..5471c534 100644 --- a/lib/Structures/Invite.js +++ b/lib/Structures/Invite.js @@ -29,4 +29,4 @@ var Invite = (function () { return Invite; })(); -module.exports = Invite; \ No newline at end of file +module.exports = Invite; diff --git a/lib/Structures/Message.js b/lib/Structures/Message.js index d6129550..6564f284 100644 --- a/lib/Structures/Message.js +++ b/lib/Structures/Message.js @@ -84,4 +84,4 @@ var Message = (function (_Equality) { return Message; })(Equality); -module.exports = Message; \ No newline at end of file +module.exports = Message; diff --git a/lib/Structures/PMChannel.js b/lib/Structures/PMChannel.js index 3f040424..b2bb2aa3 100644 --- a/lib/Structures/PMChannel.js +++ b/lib/Structures/PMChannel.js @@ -50,4 +50,4 @@ var PMChannel = (function (_Channel) { return PMChannel; })(Channel); -module.exports = PMChannel; \ No newline at end of file +module.exports = PMChannel; diff --git a/lib/Structures/PermissionOverwrite.js b/lib/Structures/PermissionOverwrite.js index f20d61b7..99f82bc0 100644 --- a/lib/Structures/PermissionOverwrite.js +++ b/lib/Structures/PermissionOverwrite.js @@ -83,4 +83,4 @@ var PermissionOverwrite = (function () { return PermissionOverwrite; })(); -module.exports = PermissionOverwrite; \ No newline at end of file +module.exports = PermissionOverwrite; diff --git a/lib/Structures/Role.js b/lib/Structures/Role.js index 048c183c..21e0f2b8 100644 --- a/lib/Structures/Role.js +++ b/lib/Structures/Role.js @@ -136,4 +136,4 @@ var Role = (function () { return Role; })(); -module.exports = Role; \ No newline at end of file +module.exports = Role; diff --git a/lib/Structures/Server.js b/lib/Structures/Server.js index 99ee3971..a43875b2 100644 --- a/lib/Structures/Server.js +++ b/lib/Structures/Server.js @@ -166,4 +166,4 @@ var Server = (function (_Equality) { return Server; })(Equality); -module.exports = Server; \ No newline at end of file +module.exports = Server; diff --git a/lib/Structures/ServerChannel.js b/lib/Structures/ServerChannel.js index 0349d33f..1e0fdae9 100644 --- a/lib/Structures/ServerChannel.js +++ b/lib/Structures/ServerChannel.js @@ -114,4 +114,4 @@ var ServerChannel = (function (_Channel) { return ServerChannel; })(Channel); -module.exports = ServerChannel; \ No newline at end of file +module.exports = ServerChannel; diff --git a/lib/Structures/TextChannel.js b/lib/Structures/TextChannel.js index 181d2035..5868bed1 100644 --- a/lib/Structures/TextChannel.js +++ b/lib/Structures/TextChannel.js @@ -55,4 +55,4 @@ var TextChannel = (function (_ServerChannel) { return TextChannel; })(ServerChannel); -module.exports = TextChannel; \ No newline at end of file +module.exports = TextChannel; diff --git a/lib/Structures/User.js b/lib/Structures/User.js index 3815089e..bd9fd546 100644 --- a/lib/Structures/User.js +++ b/lib/Structures/User.js @@ -41,6 +41,10 @@ var User = (function (_Equality) { if (obj instanceof User) return this.id === obj.id && this.username === obj.username && this.discriminator === obj.discriminator && this.avatar === obj.avatar && this.status === obj.status && this.gameID === obj.gameID;else return false; }; + User.prototype.equals = function equals(obj) { + if (obj instanceof User) return this.id === obj.id && this.username === obj.username && this.discriminator === obj.discriminator && this.avatar === obj.avatar;else return false; + }; + _createClass(User, [{ key: "avatarURL", get: function get() { @@ -55,4 +59,4 @@ var User = (function (_Equality) { return User; })(Equality); -module.exports = User; \ No newline at end of file +module.exports = User; diff --git a/lib/Structures/VoiceChannel.js b/lib/Structures/VoiceChannel.js index 333786b5..b61a9082 100644 --- a/lib/Structures/VoiceChannel.js +++ b/lib/Structures/VoiceChannel.js @@ -18,4 +18,4 @@ var VoiceChannel = (function (_ServerChannel) { return VoiceChannel; })(ServerChannel); -module.exports = VoiceChannel; \ No newline at end of file +module.exports = VoiceChannel; diff --git a/lib/Util/ArgumentRegulariser.js b/lib/Util/ArgumentRegulariser.js index 9c98ddb3..1ffbee29 100644 --- a/lib/Util/ArgumentRegulariser.js +++ b/lib/Util/ArgumentRegulariser.js @@ -2,4 +2,4 @@ exports.reg = function (c, a) { return [c].concat(Array.prototype.slice.call(a)); -}; \ No newline at end of file +}; diff --git a/lib/Util/Cache.js b/lib/Util/Cache.js index a5d97862..e8ddfe89 100644 --- a/lib/Util/Cache.js +++ b/lib/Util/Cache.js @@ -103,4 +103,4 @@ var Cache = (function (_Array) { return Cache; })(Array); -module.exports = Cache; \ No newline at end of file +module.exports = Cache; diff --git a/lib/Util/Equality.js b/lib/Util/Equality.js index 3288d530..dd5763f7 100644 --- a/lib/Util/Equality.js +++ b/lib/Util/Equality.js @@ -42,4 +42,4 @@ var Equality = (function () { return Equality; })(); -module.exports = Equality; \ No newline at end of file +module.exports = Equality; diff --git a/lib/Voice/AudioEncoder.js b/lib/Voice/AudioEncoder.js index 517a7cf6..f178f9e2 100644 --- a/lib/Voice/AudioEncoder.js +++ b/lib/Voice/AudioEncoder.js @@ -126,4 +126,4 @@ var AudioEncoder = (function () { return AudioEncoder; })(); -module.exports = AudioEncoder; \ No newline at end of file +module.exports = AudioEncoder; diff --git a/lib/Voice/StreamIntent.js b/lib/Voice/StreamIntent.js index 97953194..aa6bb38c 100644 --- a/lib/Voice/StreamIntent.js +++ b/lib/Voice/StreamIntent.js @@ -19,4 +19,4 @@ var StreamIntent = (function (_EventEmitter) { return StreamIntent; })(EventEmitter); -module.exports = StreamIntent; \ No newline at end of file +module.exports = StreamIntent; diff --git a/lib/Voice/VoiceConnection.js b/lib/Voice/VoiceConnection.js index 9af84670..c89cba4c 100644 --- a/lib/Voice/VoiceConnection.js +++ b/lib/Voice/VoiceConnection.js @@ -330,4 +330,4 @@ var VoiceConnection = (function (_EventEmitter) { return VoiceConnection; })(EventEmitter); -module.exports = VoiceConnection; \ No newline at end of file +module.exports = VoiceConnection; diff --git a/lib/Voice/VoicePacket.js b/lib/Voice/VoicePacket.js index 8fa32d5f..88bbe3b0 100644 --- a/lib/Voice/VoicePacket.js +++ b/lib/Voice/VoicePacket.js @@ -23,4 +23,4 @@ var VoicePacket = function VoicePacket(data, sequence, time, ssrc) { return returnBuffer; }; -module.exports = VoicePacket; \ No newline at end of file +module.exports = VoicePacket; diff --git a/lib/index.js b/lib/index.js index 29c9cc6a..c7f00139 100644 --- a/lib/index.js +++ b/lib/index.js @@ -15,4 +15,4 @@ module.exports = { User: require("./Structures/User"), VoiceChannel: require("./Structures/VoiceChannel"), Constants: require("./Constants.js") -}; \ No newline at end of file +}; diff --git a/src/Client/InternalClient.js b/src/Client/InternalClient.js index ad5db742..0d51d678 100644 --- a/src/Client/InternalClient.js +++ b/src/Client/InternalClient.js @@ -1627,7 +1627,7 @@ class InternalClient { 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; @@ -1635,7 +1635,7 @@ class InternalClient { } else { // a name change or avatar change - client.emit("userUpdate", user, presenceUser); + client.emit("userUpdated", user, presenceUser); self.users.update(user, presenceUser); } @@ -1656,14 +1656,14 @@ class InternalClient { } else { user.typing.since = Date.now(); user.typing.channel = channel; - client.emit("userTypingStart", user, channel); + client.emit("userTypingStarted", user, channel); } setTimeout(() => { 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); diff --git a/src/Structures/User.js b/src/Structures/User.js index c1be841e..35cecdff 100644 --- a/src/Structures/User.js +++ b/src/Structures/User.js @@ -48,6 +48,18 @@ class User extends Equality{ else return false; } + + equals(obj){ + if(obj instanceof User) + return ( + this.id === obj.id && + this.username === obj.username && + this.discriminator === obj.discriminator && + this.avatar === obj.avatar + ); + else + return false; + } } module.exports = User; \ No newline at end of file