- What's your exact discord.js
npm list discord.jsand nodenode -vversion? - Not a discord.js issue? Check out #1081585952654360687.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!
#presenceUpdate event
20 messages · Page 1 of 1 (latest)
<Presence>.activities is an array of all member's activities so if a member is playing a game and has a custom status it should contain these two activities, you didn't provide your code but it sounds like you're checking only the first activity
may i provide the code for better understanding?
ive been stuck on this for a little while
yea
sorry if its messy
im not sure how you managed to run this code without an error but the variable activites is an Array of Activities so it has no type property, the elements inside that array have this property, you would need to loop through the array to check if any of the activities is of type Custom (and types are numbers not strings so use ActivityType.Custom enum instead of just 'CUSTOM')
i tried ActivityType.Custom but it returned undefined, being on v13 i got told to use strings instead
apologies, shouldve stated that earlier
i should've paid attention to the post tags lol
so would i use newPresence.activities.type === 'CUSTOM' to get it straight from newPresence?
you need to loop through the activites array using for ... of loop for example and do the type checks and stuff inside the loop https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...of
so for example:
for (const activity of activities) {
if (activity.type === 'CUSTOM') {
rest of code
}
}
ill try it out and see
You can use activities.some() instead of a for...of loop if all you're checking is that it's equal and that's all you need. Better to use that unless you need the value of the activity or something
all i’m checking for is if there’s a custom status and it’s equal to whatever the owner sets “.gg/valuehere” & ignore all other presences
as currently, when someone changes presence (new spotify song, game change) it doesn’t properly work