mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-11 17:13:31 +01:00
Added deleteChannel implementation
This commit is contained in:
@@ -413,6 +413,28 @@ var InternalClient = (function () {
|
||||
});
|
||||
};
|
||||
|
||||
// def deleteChannel
|
||||
|
||||
InternalClient.prototype.deleteChannel = function deleteChannel(_channel) {
|
||||
var self = this;
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
self.resolver.resolveChannel(_channel).then(next)["catch"](reject);
|
||||
|
||||
function next(channel) {
|
||||
request.del(Endpoints.CHANNEL(channel.id)).set("authorization", self.token).end(function (err, res) {
|
||||
if (err) {
|
||||
reject(err);
|
||||
} else {
|
||||
channel.server.channels.remove(channel);
|
||||
self.channels.remove(channel);
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
InternalClient.prototype.sendWS = function sendWS(object) {
|
||||
if (this.websocket) this.websocket.send(JSON.stringify(object));
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user