Add voice channel moving, not quite working yet

This commit is contained in:
meew0
2016-01-24 23:22:24 +01:00
parent 76ab439033
commit 042d7d1dbe
4 changed files with 52 additions and 0 deletions

View File

@@ -694,6 +694,25 @@ var InternalClient = (function () {
return this.apiRequest("del", _Constants.Endpoints.SERVER_MEMBERS(server.id) + "/" + user.id, true);
};
// def moveMember
InternalClient.prototype.moveMember = function moveMember(user, server, channel) {
user = this.resolver.resolveUser(user);
server = this.resolver.resolveServer(server);
channel = this.resolver.resolveChannel(channel);
console.log(channel.type);
// Make sure `channel` is a voice channel
if (channel.type !== "voice") {
throw new Error("Can't moveMember into a non-voice channel");
} else {
return this.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) {