Merge pull request #168 from hydrabolt/issue/144

Allow moving users to voice channels
This commit is contained in:
abalabahaha
2016-01-29 14:04:05 -08:00
5 changed files with 64 additions and 0 deletions

View File

@@ -708,6 +708,27 @@ var InternalClient = (function () {
return this.apiRequest("del", _Constants.Endpoints.SERVER_MEMBERS(server.id) + "/" + user.id, true);
};
// def moveMember
InternalClient.prototype.moveMember = function moveMember(user, channel) {
var _this19 = this;
user = this.resolver.resolveUser(user);
return this.resolver.resolveChannel(channel).then(function (channel) {
var server = channel.server;
// Make sure `channel` is a voice channel
if (channel.type !== "voice") {
throw new Error("Can't moveMember into a non-voice channel");
} else {
return _this19.apiRequest("patch", _Constants.Endpoints.SERVER_MEMBERS(server.id) + "/" + user.id, true, { channel_id: channel.id }).then(function (res) {
user.voiceChannel = channel;
return res;
});
}
});
};
// def createRole
InternalClient.prototype.createRole = function createRole(server, data) {