From c86a6154aa736aee6bde9fa76ebd34b24225ee79 Mon Sep 17 00:00:00 2001 From: Will Nelson Date: Tue, 10 Sep 2019 02:00:04 -0700 Subject: [PATCH] feat(VoiceState): add kick method (#3462) * feat(VoiceState): add kick method * feat(typings): add types for VoiceState#kick method --- src/structures/VoiceState.js | 9 +++++++++ typings/index.d.ts | 1 + 2 files changed, 10 insertions(+) diff --git a/src/structures/VoiceState.js b/src/structures/VoiceState.js index e2cb2ab99..8e2922a96 100644 --- a/src/structures/VoiceState.js +++ b/src/structures/VoiceState.js @@ -139,6 +139,15 @@ class VoiceState extends Base { return this.member ? this.member.edit({ deaf }, reason) : Promise.reject(new Error('VOICE_STATE_UNCACHED_MEMBER')); } + /** + * Kicks the member from the voice channel. + * @param {string} [reason] Reason for kicking member from the channel + * @returns {Promise} + */ + kick(reason) { + return this.setChannel(null, reason); + } + /** * Moves the member to a different channel, or kick them from the one they're in. * @param {ChannelResolvable|null} [channel] Channel to move the member to, or `null` if you want to kick them from diff --git a/typings/index.d.ts b/typings/index.d.ts index 13405c3f0..22e40854c 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -1590,6 +1590,7 @@ declare module 'discord.js' { public setDeaf(deaf: boolean, reason?: string): Promise; public setMute(mute: boolean, reason?: string): Promise; + public kick(reason?: string): Promise; public setChannel(channel: ChannelResolvable | null, reason?: string): Promise; public setSelfDeaf(deaf: boolean): Promise; public setSelfMute(mute: boolean): Promise;