#presenceUpdate event

20 messages · Page 1 of 1 (latest)

tiny mesaBOT
#
  • What's your exact discord.js npm list discord.js and node node -v version?
  • 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!
bleak swallow
#

<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

young dawn
#

may i provide the code for better understanding?

ive been stuck on this for a little while

young dawn
bleak swallow
#

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')

young dawn
#

i tried ActivityType.Custom but it returned undefined, being on v13 i got told to use strings instead

bleak swallow
#

oh right

#

you're using v13 i didnt realise

young dawn
#

apologies, shouldve stated that earlier

bleak swallow
#

i should've paid attention to the post tags lol

young dawn
#

so would i use newPresence.activities.type === 'CUSTOM' to get it straight from newPresence?

bleak swallow
young dawn
#

ill try it out and see

haughty token
#

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

young dawn
#

as currently, when someone changes presence (new spotify song, game change) it doesn’t properly work

haughty token
#

Ah, then you probably want to use find instead

#

What's your current code