diff --git a/src/client/rest/RESTMethods.js b/src/client/rest/RESTMethods.js index 457cb103c..02ae9c461 100644 --- a/src/client/rest/RESTMethods.js +++ b/src/client/rest/RESTMethods.js @@ -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); diff --git a/src/structures/GuildMember.js b/src/structures/GuildMember.js index 9294b3dab..e10f11d6c 100644 --- a/src/structures/GuildMember.js +++ b/src/structures/GuildMember.js @@ -351,7 +351,8 @@ class GuildMember { * @property {Collection|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} * @example * // Moves a member to a voice channel diff --git a/typings/index.d.ts b/typings/index.d.ts index cf55da2ad..deb59c9af 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -668,7 +668,7 @@ declare module 'discord.js' { public ban(options?: BanOptions | number | string): Promise; public createDM(): Promise; public deleteDM(): Promise; - public edit(data: object, reason?: string): Promise; + public edit(data: GuildMemberEditData, reason?: string): Promise; public hasPermission(permission: PermissionResolvable, explicit?: boolean, checkAdmin?: boolean, checkOwner?: boolean): boolean; public hasPermissions(permission: PermissionResolvable, explicit?: boolean): boolean; public kick(reason?: string): Promise; @@ -680,7 +680,7 @@ declare module 'discord.js' { public setMute(mute: boolean, reason?: string): Promise; public setNickname(nickname: string, reason?: string): Promise; public setRoles(roles: Collection | Role[] | Snowflake[], reason?: string): Promise; - public setVoiceChannel(voiceChannel: ChannelResolvable): Promise; + public setVoiceChannel(voiceChannel: ChannelResolvable | null): Promise; public toString(): string; } @@ -1822,7 +1822,7 @@ declare module 'discord.js' { roles?: Collection | Role[] | Snowflake[]; mute?: boolean; deaf?: boolean; - channel?: ChannelResolvable; + channel?: ChannelResolvable | null; }; type GuildMemberResolvable = GuildMember | User;