mirror of
https://github.com/danbulant/discord.js
synced 2026-06-16 13:11:31 +00:00
Fix collectors and make guild sync add previously unknown members
This commit is contained in:
parent
09dee3d46a
commit
7ff2568cfc
5 changed files with 8 additions and 6 deletions
|
|
@ -17,7 +17,9 @@ class GuildMemberRemoveAction extends Action {
|
|||
guild.memberCount--;
|
||||
guild._removeMember(member);
|
||||
this.deleted[guild.id + data.user.id] = member;
|
||||
client.emit(Constants.Events.GUILD_MEMBER_REMOVE, guild, member);
|
||||
if (client.status === Constants.Status.READY) {
|
||||
client.emit(Constants.Events.GUILD_MEMBER_REMOVE, guild, member);
|
||||
}
|
||||
this.scheduleForDeletion(guild.id, data.user.id);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@ class GuildSync extends Action {
|
|||
const member = guild.members.get(syncMember.user.id);
|
||||
if (member) {
|
||||
guild._updateMember(member, syncMember);
|
||||
} else {
|
||||
guild._addMember(syncMember);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ const BeforeReadyWhitelist = [
|
|||
Constants.WSEvents.GUILD_CREATE,
|
||||
Constants.WSEvents.GUILD_DELETE,
|
||||
Constants.WSEvents.GUILD_MEMBERS_CHUNK,
|
||||
Constants.WSEvents.GUILD_MEMBER_ADD,
|
||||
Constants.WSEvents.GUILD_MEMBER_REMOVE,
|
||||
];
|
||||
|
||||
class WebSocketPacketManager {
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ const EventEmitter = require('events').EventEmitter;
|
|||
* ```js
|
||||
* {
|
||||
* time: null, // time in milliseconds. If specified, the collector ends after this amount of time.
|
||||
* allowSelf: false, // whether or not the filter should take messages from the logged in client.
|
||||
* max: null, // the maximum amount of messages to handle before ending.
|
||||
* }
|
||||
* ```
|
||||
|
|
@ -77,9 +76,6 @@ class MessageCollector extends EventEmitter {
|
|||
if (this.channel ? this.channel.id !== message.channel.id : false) {
|
||||
return false;
|
||||
}
|
||||
if (message.author.id === this.channel.client.user.id && !this.options.allowSelf) {
|
||||
return false;
|
||||
}
|
||||
if (this.filter(message, this)) {
|
||||
this.collected.set(message.id, message);
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ const Discord = require('../');
|
|||
const request = require('superagent');
|
||||
const fs = require('fs');
|
||||
|
||||
const client = new Discord.Client({ fetch_all_members: true });
|
||||
const client = new Discord.Client({ fetch_all_members: false });
|
||||
|
||||
const { email, password, token } = require('./auth.json');
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue