You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please describe the problem you are having in as much detail as possible:
If you extend Presence with, say, PresenceExt, some members will have Presence, some will have PresenceExt. It seems like they will always have PresenceExt after a legitimate presenceUpdate.
Include a reproducible code sample here, if possible:
//Formatting helps with my bad eyes. Don't shoot.//Extend the Presence structure...Discord.Structures.extend('Presence',Presence=>classPresenceExtextendsPresence{//Give it a simple method to test...getisTwitchStreaming(){returnthis.activities.some(({ name, type })=>name==='Twitch'&&type==='STREAMING');}});//Initialize the client...constbot=newDiscord.Client({//I know, not recommended. I only use it for small, private bots...fetchAllMembers: true});bot.on('ready',()=>{//Get a random guild...constguild=bot.guilds.cache.random();;//Add up the PresenceExt and Presence...constresults=guild.members.cache.reduce((results,{presence: {constructor: { name }}})=>({ ...results,[name]: 1+(results[name]??0)}),{});//{ PresenceExt: 241, Presence: 2065 }...console.log(results);});//These will all be PresenceExt...bot.on('presenceUpdate',(_,{constructor: { name }})=>console.log(name));
Further details:
discord.js version: 12.2.0
Node.js version: 14.4.0
Operating system: Windows
Priority this issue should have – please be realistic and elaborate if possible: Low
This is due to GuildMember#presence and User#presence returning new Presence(...); when no presence is available for the member (or user), which does not account for extensions.
This should be fixable by returning something like new (Structures.get('Presence'))(...) instead.
Please describe the problem you are having in as much detail as possible:
If you extend
Presence
with, say,PresenceExt
, some members will havePresence
, some will havePresenceExt
. It seems like they will always havePresenceExt
after a legitimatepresenceUpdate
.Include a reproducible code sample here, if possible:
Further details:
Relevant client options:
[ 'CHANNEL', 'GUILD_MEMBER', 'MESSAGE', 'REACTION', 'USER' ]
The text was updated successfully, but these errors were encountered: