mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
Built internal changes
This commit is contained in:
@@ -142,6 +142,34 @@ var InternalClient = (function () {
|
||||
});
|
||||
};
|
||||
|
||||
//def joinServer
|
||||
|
||||
InternalClient.prototype.joinServer = function joinServer(invite) {
|
||||
var self = this;
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
invite = self.resolver.resolveInvite(invite);
|
||||
if (invite) {
|
||||
|
||||
request.post(Endpoints.INVITE(invite.id)).set("authorization", self.token).end(function (err, res) {
|
||||
if (err) {
|
||||
reject(err);
|
||||
} else {
|
||||
// valid server, wait until it is received via ws and cached
|
||||
var inter = setInterval(function () {
|
||||
if (self.servers.get("id", res.body.guild.id)) {
|
||||
clearInterval(inter);
|
||||
resolve(self.servers.get("id", res.body.guild.id));
|
||||
}
|
||||
}, 20);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
reject(new Error("Not a valid invite"));
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
//def leaveServer
|
||||
|
||||
InternalClient.prototype.leaveServer = function leaveServer(srv) {
|
||||
@@ -1459,4 +1487,4 @@ var InternalClient = (function () {
|
||||
return InternalClient;
|
||||
})();
|
||||
|
||||
module.exports = InternalClient;
|
||||
module.exports = InternalClient;
|
||||
Reference in New Issue
Block a user