diff options
author | Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> | 2021-10-17 22:28:15 +0200 |
---|---|---|
committer | Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> | 2021-10-17 22:28:15 +0200 |
commit | 5c38999afac9ead4c5d1b90518098be726d1bdf2 (patch) | |
tree | 38a84332299b008b9af1c3a3ff6280a09ddd642e /gateway | |
parent | :sparkles: config override file (diff) | |
download | server-5c38999afac9ead4c5d1b90518098be726d1bdf2.tar.xz |
:bug: also receive events for newly added members/relationships
Diffstat (limited to 'gateway')
-rw-r--r-- | gateway/src/listener/listener.ts | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/gateway/src/listener/listener.ts b/gateway/src/listener/listener.ts index 79659a1f..032b2375 100644 --- a/gateway/src/listener/listener.ts +++ b/gateway/src/listener/listener.ts @@ -117,7 +117,7 @@ export async function setupListener(this: WebSocket) { // TODO: only subscribe for events that are in the connection intents async function consume(this: WebSocket, opts: EventOpts) { const { data, event } = opts; - const id = data.id as string; + let id = data.id as string; const permission = this.permissions[id] || new Permissions("ADMINISTRATOR"); // default permission for dm const consumer = consume.bind(this); @@ -138,6 +138,10 @@ async function consume(this: WebSocket, opts: EventOpts) { this.listen_options ); break; + case "GUILD_MEMBER_REMOVE": + if (!this.member_events[data.user.id]) break; + this.member_events[data.user.id](); + break; case "RELATIONSHIP_REMOVE": case "CHANNEL_DELETE": case "GUILD_DELETE": @@ -151,7 +155,14 @@ async function consume(this: WebSocket, opts: EventOpts) { .has("VIEW_CHANNEL") ) return; - //No break needed here, we need to call the listenEvent function below + // No break needed here, we need to call the listenEvent function below + case "RELATIONSHIP_ADD": + this.events[data.user.id] = await listenEvent( + data.user.id, + handlePresenceUpdate.bind(this), + this.listen_options + ); + break; case "GUILD_CREATE": this.events[id] = await listenEvent(id, consumer, listenOpts); break; |