mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-18 20:43:30 +01:00
createInvite forgot to Promise properly
This commit is contained in:
@@ -976,25 +976,21 @@ var InternalClient = (function () {
|
|||||||
InternalClient.prototype.createInvite = function createInvite(chanServ, options) {
|
InternalClient.prototype.createInvite = function createInvite(chanServ, options) {
|
||||||
var _this26 = this;
|
var _this26 = this;
|
||||||
|
|
||||||
chanServ = this.resolver.resolveChannel(chanServ);
|
return this.resolver.resolveChannel(chanServ).then(function (channel) {
|
||||||
|
if (!options) {
|
||||||
|
options = {
|
||||||
|
validate: null
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
options.max_age = options.maxAge || 0;
|
||||||
|
options.max_uses = options.maxUses || 0;
|
||||||
|
options.temporary = options.temporary || false;
|
||||||
|
options.xkcdpass = options.xkcd || false;
|
||||||
|
}
|
||||||
|
|
||||||
if (!chanServ) {
|
return _this26.apiRequest("post", _Constants.Endpoints.CHANNEL_INVITES(channel.id), true, options).then(function (res) {
|
||||||
throw new Error("couldn't resolve where");
|
return new _StructuresInvite2["default"](res, _this26.channels.get("id", res.channel.id), _this26.client);
|
||||||
}
|
});
|
||||||
|
|
||||||
if (!options) {
|
|
||||||
options = {
|
|
||||||
validate: null
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
options.max_age = options.maxAge || 0;
|
|
||||||
options.max_uses = options.maxUses || 0;
|
|
||||||
options.temporary = options.temporary || false;
|
|
||||||
options.xkcdpass = options.xkcd || false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.apiRequest("post", _Constants.Endpoints.CHANNEL_INVITES(chanServ.id), true, options).then(function (res) {
|
|
||||||
return new _StructuresInvite2["default"](res, _this26.channels.get("id", res.channel.id), _this26.client);
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -786,25 +786,22 @@ export default class InternalClient {
|
|||||||
|
|
||||||
// def createInvite
|
// def createInvite
|
||||||
createInvite(chanServ, options) {
|
createInvite(chanServ, options) {
|
||||||
chanServ = this.resolver.resolveChannel(chanServ);
|
return this.resolver.resolveChannel(chanServ)
|
||||||
|
.then(channel => {
|
||||||
|
if (!options) {
|
||||||
|
options = {
|
||||||
|
validate: null
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
options.max_age = options.maxAge || 0;
|
||||||
|
options.max_uses = options.maxUses || 0;
|
||||||
|
options.temporary = options.temporary || false;
|
||||||
|
options.xkcdpass = options.xkcd || false;
|
||||||
|
}
|
||||||
|
|
||||||
if (!chanServ) {
|
return this.apiRequest("post", Endpoints.CHANNEL_INVITES(channel.id), true, options)
|
||||||
throw new Error("couldn't resolve where");
|
.then(res => new Invite(res, this.channels.get("id", res.channel.id), this.client));
|
||||||
}
|
});
|
||||||
|
|
||||||
if (!options) {
|
|
||||||
options = {
|
|
||||||
validate: null
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
options.max_age = options.maxAge || 0;
|
|
||||||
options.max_uses = options.maxUses || 0;
|
|
||||||
options.temporary = options.temporary || false;
|
|
||||||
options.xkcdpass = options.xkcd || false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.apiRequest("post", Endpoints.CHANNEL_INVITES(chanServ.id), true, options)
|
|
||||||
.then(res => new Invite(res, this.channels.get("id", res.channel.id), this.client));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//def deleteInvite
|
//def deleteInvite
|
||||||
|
|||||||
Reference in New Issue
Block a user