mirror of
https://github.com/danbulant/discord.js
synced 2026-06-19 22:51:32 +00:00
Join Server returns server properly
Previously if the client was already part of a server and attempted to accept an invite to it again, it would stall and not work correctly.
This commit is contained in:
parent
7300dec912
commit
1c8c9d2da3
12 changed files with 22 additions and 14 deletions
|
|
@ -529,7 +529,11 @@ var Client = (function () {
|
|||
callback(err);
|
||||
reject(err);
|
||||
} else {
|
||||
self.serverCreateListener.set(res.body.guild.id, [resolve, callback]);
|
||||
if (self.getServer("id", res.body.guild.id)) {
|
||||
resolve(self.getServer("id", res.body.guild.id));
|
||||
} else {
|
||||
self.serverCreateListener.set(res.body.guild.id, [resolve, callback]);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
@ -1433,4 +1437,4 @@ function getGateway() {
|
|||
});
|
||||
}
|
||||
|
||||
module.exports = Client;
|
||||
module.exports = Client;
|
||||
|
|
@ -10,4 +10,4 @@ exports.LOGIN = exports.AUTH + "/login";
|
|||
exports.LOGOUT = exports.AUTH + "/logout";
|
||||
exports.USERS = exports.API + "/users";
|
||||
exports.SERVERS = exports.API + "/guilds";
|
||||
exports.CHANNELS = exports.API + "/channels";
|
||||
exports.CHANNELS = exports.API + "/channels";
|
||||
|
|
@ -58,4 +58,4 @@ var PMChannel = (function () {
|
|||
return PMChannel;
|
||||
})();
|
||||
|
||||
module.exports = PMChannel;
|
||||
module.exports = PMChannel;
|
||||
|
|
@ -19,7 +19,7 @@ var Channel = (function () {
|
|||
_createClass(Channel, [{
|
||||
key: "equals",
|
||||
value: function equals(object) {
|
||||
return object.id === this.id;
|
||||
return object && object.id === this.id;
|
||||
}
|
||||
}, {
|
||||
key: "addMessage",
|
||||
|
|
@ -76,4 +76,4 @@ var Channel = (function () {
|
|||
return Channel;
|
||||
})();
|
||||
|
||||
module.exports = Channel;
|
||||
module.exports = Channel;
|
||||
|
|
@ -9,4 +9,4 @@ var Discord = {
|
|||
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;
|
||||
})();
|
||||
|
||||
module.exports = Invite;
|
||||
module.exports = Invite;
|
||||
|
|
@ -69,4 +69,4 @@ var Message = (function () {
|
|||
return Message;
|
||||
})();
|
||||
|
||||
module.exports = Message;
|
||||
module.exports = Message;
|
||||
|
|
@ -170,4 +170,4 @@ var Server = (function () {
|
|||
return Server;
|
||||
})();
|
||||
|
||||
module.exports = Server;
|
||||
module.exports = Server;
|
||||
|
|
@ -53,4 +53,4 @@ var User = (function () {
|
|||
return User;
|
||||
})();
|
||||
|
||||
module.exports = User;
|
||||
module.exports = User;
|
||||
|
|
@ -542,7 +542,11 @@ class Client {
|
|||
callback(err);
|
||||
reject(err);
|
||||
} else {
|
||||
self.serverCreateListener.set(res.body.guild.id, [resolve, callback]);
|
||||
if (self.getServer("id", res.body.guild.id)) {
|
||||
resolve(self.getServer("id", res.body.guild.id));
|
||||
} else {
|
||||
self.serverCreateListener.set(res.body.guild.id, [resolve, callback]);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ class Channel {
|
|||
}
|
||||
|
||||
equals(object) {
|
||||
return object.id === this.id;
|
||||
return (object && object.id === this.id);
|
||||
}
|
||||
|
||||
addMessage(data){
|
||||
|
|
|
|||
Loading…
Reference in a new issue