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; let member = null;
if (guild) { if (guild) {
member = guild.members.get(data.user.id); member = guild.members.get(data.user.id);
guild.memberCount--;
if (member) { if (member) {
guild.memberCount--;
guild.members.remove(member.id); guild.members.remove(member.id);
if (client.status === Status.READY) client.emit(Events.GUILD_MEMBER_REMOVE, member); 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 * @param {string} [options.reason] Reason for cloning this channel
* @returns {Promise<GuildChannel>} * @returns {Promise<GuildChannel>}
*/ */
clone({ name = this.name, withPermissions = true, withTopic = true, nsfw, parent, bitrate, userLimit, reason } = {}) { clone(options = {}) {
const options = { if (typeof options.withPermissions === 'undefined') options.withPermissions = true;
overwrites: withPermissions ? this.permissionOverwrites : [], Util.mergeDefault({
nsfw: typeof nsfw === 'undefined' ? this.nsfw : nsfw, name: this.name,
parent: parent || this.parent, overwrites: options.withPermissions ? this.permissionOverwrites : [],
bitrate: bitrate || this.bitrate, withTopic: true,
userLimit: userLimit || this.userLimit, nsfw: this.nsfw,
reason, parent: this.parent,
type: this.type, bitrate: this.bitrate,
}; userLimit: this.userLimit,
return this.guild.channels.create(name, options) reason: null,
.then(channel => withTopic ? channel.setTopic(this.topic) : channel); }, 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) { kick(reason) {
return this.client.api.guilds(this.guild.id).members(this.user.id).delete({ reason }) return this.client.api.guilds(this.guild.id).members(this.user.id).delete({ reason })
.then(() => .then(() => this);
this.client.actions.GuildMemberRemove.handle({
guild_id: this.guild.id,
user: this.user,
}).member
);
} }
/** /**