don't know how to go about getting rid of this
i'm not sure what to put in my
memberActivity?.name
field to make it show whatever the user is playing other than "custom status" when they have a custom status, but are actually playing another game. this is the setup of that part:
17 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- 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!i have been working on this for a few days and can't seem to figure it out honestly
Activity.state is the text of the custom status
yeah, i changed it a bit, my issue is how the title gets overriden to "playing Custom Status" when the user isn't playing anything, but has a custom status
i did originally intend for it to only put a description of an actual custom status but it's fine ig
"Custom Status" is the
name
of the activity, "test" is the state
of that activityActivity.type isn't an array either so I'm not surprised that this isn't evaluating correctly
it wasn't, i edited it just now lol
the top message is how i intend for the title to look when there is just a custom status set, the description of the second is what i want to be in that top message
if that makes sense
but i haven't been able to
if
the custom status out correctly, i only thought of doing a bajillion if
statements
but i don't think it's necessary to do that
idkSo if there's a custom status you want the title to just be the status, otherwise "playing <thing>"?
nah i want the description to be the status, and the title to say "playing nothing" if they're playing nothing, but "playing x" if they're playing an actual thing
idk how to say that less confusingly
Sometimes building it with if statements is a good starting point instead of jumping to using short circuits and other things that are less obvious to read
i think my main issue at this point is that i'm unsure how to work out the name part that wants to say "Custom Status" because i don't think
isMember?.presence?.activities[!4].name
(4 being the custom status) is a thing, i can't really remember
actually
it might just be [4]?
but then it just does playing nothing, idk, i'll mess around w it a bit morei was going off of this
maybe i misunderstood that part
it seems to think that the "type" of a custom status is
Playing
in my codei've gotten it to work how i wanted with
.find
, tysm ^^
i ended up doing const activityName = isMember?.presence.activities.find(activity => activity.type !== 4);
for .setTitle(bold(activities[activityName?.type] || 'Playing ') + italic(activityName?.name || 'nothing'))
and .setDescription((isMember?.presence.activities.find(activity => activity.type === 4)?.state || 'Set a custom status!'))
for the description & that's exactly what i needed