mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-13 01:53:30 +01:00
feat(GuildMember): add support for voice kicking (#3246)
This backports e64773e21b (#3242)
This commit is contained in:
@@ -513,8 +513,10 @@ class RESTMethods {
|
|||||||
return Promise.reject(new Error('Could not resolve channel to a guild voice channel.'));
|
return Promise.reject(new Error('Could not resolve channel to a guild voice channel.'));
|
||||||
}
|
}
|
||||||
data.channel_id = channel.id;
|
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);
|
if (data.roles) data.roles = data.roles.map(role => role instanceof Role ? role.id : role);
|
||||||
|
|
||||||
let endpoint = Endpoints.Member(member);
|
let endpoint = Endpoints.Member(member);
|
||||||
|
|||||||
@@ -351,7 +351,8 @@ class GuildMember {
|
|||||||
* @property {Collection<Snowflake, Role>|RoleResolvable[]} [roles] The roles or role IDs to apply
|
* @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} [mute] Whether or not the member should be muted
|
||||||
* @property {boolean} [deaf] Whether or not the member should be deafened
|
* @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.
|
* 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>}
|
* @returns {Promise<GuildMember>}
|
||||||
* @example
|
* @example
|
||||||
* // Moves a member to a voice channel
|
* // Moves a member to a voice channel
|
||||||
|
|||||||
6
typings/index.d.ts
vendored
6
typings/index.d.ts
vendored
@@ -668,7 +668,7 @@ declare module 'discord.js' {
|
|||||||
public ban(options?: BanOptions | number | string): Promise<GuildMember>;
|
public ban(options?: BanOptions | number | string): Promise<GuildMember>;
|
||||||
public createDM(): Promise<DMChannel>;
|
public createDM(): Promise<DMChannel>;
|
||||||
public deleteDM(): Promise<DMChannel>;
|
public deleteDM(): Promise<DMChannel>;
|
||||||
public edit(data: object, reason?: string): Promise<GuildMember>;
|
public edit(data: GuildMemberEditData, reason?: string): Promise<GuildMember>;
|
||||||
public hasPermission(permission: PermissionResolvable, explicit?: boolean, checkAdmin?: boolean, checkOwner?: boolean): boolean;
|
public hasPermission(permission: PermissionResolvable, explicit?: boolean, checkAdmin?: boolean, checkOwner?: boolean): boolean;
|
||||||
public hasPermissions(permission: PermissionResolvable, explicit?: boolean): boolean;
|
public hasPermissions(permission: PermissionResolvable, explicit?: boolean): boolean;
|
||||||
public kick(reason?: string): Promise<GuildMember>;
|
public kick(reason?: string): Promise<GuildMember>;
|
||||||
@@ -680,7 +680,7 @@ declare module 'discord.js' {
|
|||||||
public setMute(mute: boolean, reason?: string): Promise<GuildMember>;
|
public setMute(mute: boolean, reason?: string): Promise<GuildMember>;
|
||||||
public setNickname(nickname: string, reason?: string): Promise<GuildMember>;
|
public setNickname(nickname: string, reason?: string): Promise<GuildMember>;
|
||||||
public setRoles(roles: Collection<Snowflake, Role> | Role[] | Snowflake[], reason?: string): Promise<GuildMember>;
|
public setRoles(roles: Collection<Snowflake, Role> | Role[] | Snowflake[], reason?: string): Promise<GuildMember>;
|
||||||
public setVoiceChannel(voiceChannel: ChannelResolvable): Promise<GuildMember>;
|
public setVoiceChannel(voiceChannel: ChannelResolvable | null): Promise<GuildMember>;
|
||||||
public toString(): string;
|
public toString(): string;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1822,7 +1822,7 @@ declare module 'discord.js' {
|
|||||||
roles?: Collection<Snowflake, Role> | Role[] | Snowflake[];
|
roles?: Collection<Snowflake, Role> | Role[] | Snowflake[];
|
||||||
mute?: boolean;
|
mute?: boolean;
|
||||||
deaf?: boolean;
|
deaf?: boolean;
|
||||||
channel?: ChannelResolvable;
|
channel?: ChannelResolvable | null;
|
||||||
};
|
};
|
||||||
|
|
||||||
type GuildMemberResolvable = GuildMember | User;
|
type GuildMemberResolvable = GuildMember | User;
|
||||||
|
|||||||
Reference in New Issue
Block a user