This commit is contained in:
Amish Shah
2018-01-21 10:29:06 +00:00
3 changed files with 17 additions and 19 deletions

View File

@@ -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);
}

View File

@@ -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);
}
/**

View File

@@ -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);
}
/**