mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-11 17:13:31 +01:00
Merge pull request #168 from hydrabolt/issue/144
Allow moving users to voice channels
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user