feat(GuildMember): add support for voice kicking (#3246)

This backports e64773e21b (#3242)
This commit is contained in:
SpaceEEC
2019-05-06 19:18:29 +02:00
committed by GitHub
parent 67da457c0a
commit ee42bdfd76
3 changed files with 10 additions and 6 deletions

View File

@@ -513,8 +513,10 @@ class RESTMethods {
return Promise.reject(new Error('Could not resolve channel to a guild voice channel.'));
}
data.channel_id = channel.id;
data.channel = null;
} else if (data.channel === null) {
data.channel_id = null;
}
data.channel = undefined;
if (data.roles) data.roles = data.roles.map(role => role instanceof Role ? role.id : role);
let endpoint = Endpoints.Member(member);

View File

@@ -351,7 +351,8 @@ class GuildMember {
* @property {Collection<Snowflake, Role>|RoleResolvable[]} [roles] The roles or role IDs to apply
* @property {boolean} [mute] Whether or not the member should be muted
* @property {boolean} [deaf] Whether or not the member should be deafened
* @property {ChannelResolvable} [channel] Channel to move member to (if they are connected to voice)
* @property {ChannelResolvable|null} [channel] Channel to move member to (if they are connected to voice), or `null`
* if you want to kick them from voice
*/
/**
@@ -404,7 +405,8 @@ class GuildMember {
/**
* Moves this member to the given channel.
* @param {ChannelResolvable} channel The channel to move the member to
* @param {ChannelResolvable|null} channel Channel to move the member to, or `null` if you want to kick them from
* voice
* @returns {Promise<GuildMember>}
* @example
* // Moves a member to a voice channel