Discord.js: New withPresences: true tries to add to cache, "add is not a function"

Created on 18 Apr 2020  Â·  6Comments  Â·  Source: discordjs/discord.js

Please describe the problem you are having in as much detail as possible:
New {withPresences: true} has incorrect code for adding to presence cache.

Include a reproducible code sample here, if possible:

// Place your code here
let members = await s.members.fetch({withPresences: true});

Further details:

Uncaught Exception> TypeError: guild.presences.cache.add is not a function
    at Object.module.exports [as GUILD_MEMBERS_CHUNK] (node_modules/discord.js/src/client/websocket/handlers/GUILD_MEMBERS_CHUNK.js:13:66)
    at WebSocketManager.handlePacket (node_modules/discord.js/src/client/websocket/WebSocketManager.js:386:31)
    at WebSocketShard.onPacket (node_modules/discord.js/src/client/websocket/WebSocketShard.js:436:22)
    at WebSocketShard.onMessage (node_modules/discord.js/src/client/websocket/WebSocketShard.js:293:10)
    at WebSocket.onMessage (node_modules/ws/lib/event-target.js:120:16)
    at WebSocket.emit (events.js:321:20)
    at Receiver.receiverOnMessage (node_modules/ws/lib/websocket.js:801:20)
    at Receiver.emit (events.js:321:20)
    at Receiver.dataMessage (node_modules/ws/lib/receiver.js:427:14)
    at Receiver.getData (node_modules/ws/lib/receiver.js:366:17)
  • discord.js version: 12.2 master
  • Node.js version: 13.13.0
  • Operating system: Debian 9
  • Priority this issue should have – please be realistic and elaborate if possible:
    High, cannot use this option
  • [x] I have also tested the issue on latest master, commit hash:
unverified caching gateway bug

All 6 comments

Yeah it seems from #3562 the packet handler is calling guild.presences.cache.add() instead of guild.presences.add()

Yeah I figured that was the issue just wanted to surface the bug!

This is an easy fix, ill submit a pr to fix it in a minute

I just fixed it locally and the presence doesn't seem to be on the member still. When I try "member.presence", it is undefined

Is this a result of the presence intent being needed?

if you do not have the presence intent you will not receive the presence data, naturally. i cannot reproduce with all intents after clearing caches

Was this page helpful?
0 / 5 - 0 ratings

Related issues

shukriadams picture shukriadams  Â·  3Comments

Lombra picture Lombra  Â·  3Comments

Dmitry221060 picture Dmitry221060  Â·  3Comments

xCuzImPro picture xCuzImPro  Â·  3Comments

DatMayo picture DatMayo  Â·  3Comments