Skip to content

Commit

Permalink
feat(VoiceState): add kick method (#3462)
Browse files Browse the repository at this point in the history
* feat(VoiceState): add kick method

* feat(typings): add types for VoiceState#kick method
  • Loading branch information
Will Nelson authored and amishshah committed Sep 10, 2019
1 parent a6810e2 commit c86a615
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/structures/VoiceState.js
Original file line number Diff line number Diff line change
Expand Up @@ -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<GuildMember>}
*/
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
Expand Down
1 change: 1 addition & 0 deletions typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1590,6 +1590,7 @@ declare module 'discord.js' {

public setDeaf(deaf: boolean, reason?: string): Promise<GuildMember>;
public setMute(mute: boolean, reason?: string): Promise<GuildMember>;
public kick(reason?: string): Promise<GuildMember>;
public setChannel(channel: ChannelResolvable | null, reason?: string): Promise<GuildMember>;
public setSelfDeaf(deaf: boolean): Promise<boolean>;
public setSelfMute(mute: boolean): Promise<boolean>;
Expand Down

0 comments on commit c86a615

Please sign in to comment.