mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 08:33:30 +01:00
Merge branch 'master' of https://github.com/hydrabolt/discord.js
This commit is contained in:
@@ -8,8 +8,8 @@ class GuildMemberRemoveAction extends Action {
|
||||
let member = null;
|
||||
if (guild) {
|
||||
member = guild.members.get(data.user.id);
|
||||
guild.memberCount--;
|
||||
if (member) {
|
||||
guild.memberCount--;
|
||||
guild.members.remove(member.id);
|
||||
if (client.status === Status.READY) client.emit(Events.GUILD_MEMBER_REMOVE, member);
|
||||
}
|
||||
|
||||
@@ -445,18 +445,21 @@ class GuildChannel extends Channel {
|
||||
* @param {string} [options.reason] Reason for cloning this channel
|
||||
* @returns {Promise<GuildChannel>}
|
||||
*/
|
||||
clone({ name = this.name, withPermissions = true, withTopic = true, nsfw, parent, bitrate, userLimit, reason } = {}) {
|
||||
const options = {
|
||||
overwrites: withPermissions ? this.permissionOverwrites : [],
|
||||
nsfw: typeof nsfw === 'undefined' ? this.nsfw : nsfw,
|
||||
parent: parent || this.parent,
|
||||
bitrate: bitrate || this.bitrate,
|
||||
userLimit: userLimit || this.userLimit,
|
||||
reason,
|
||||
type: this.type,
|
||||
};
|
||||
return this.guild.channels.create(name, options)
|
||||
.then(channel => withTopic ? channel.setTopic(this.topic) : channel);
|
||||
clone(options = {}) {
|
||||
if (typeof options.withPermissions === 'undefined') options.withPermissions = true;
|
||||
Util.mergeDefault({
|
||||
name: this.name,
|
||||
overwrites: options.withPermissions ? this.permissionOverwrites : [],
|
||||
withTopic: true,
|
||||
nsfw: this.nsfw,
|
||||
parent: this.parent,
|
||||
bitrate: this.bitrate,
|
||||
userLimit: this.userLimit,
|
||||
reason: null,
|
||||
}, options);
|
||||
options.type = this.type;
|
||||
return this.guild.channels.create(options.name, options)
|
||||
.then(channel => options.withTopic ? channel.setTopic(this.topic) : channel);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -526,12 +526,7 @@ class GuildMember extends Base {
|
||||
*/
|
||||
kick(reason) {
|
||||
return this.client.api.guilds(this.guild.id).members(this.user.id).delete({ reason })
|
||||
.then(() =>
|
||||
this.client.actions.GuildMemberRemove.handle({
|
||||
guild_id: this.guild.id,
|
||||
user: this.user,
|
||||
}).member
|
||||
);
|
||||
.then(() => this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user