Setting client activity dynamically: Missing ) after argument list

Question:
I keep getting this error with my code, but can’t seem to find anything wrong with it: `file:///home/runner/ggjhbot-1/index.js:51
client.user.setActivity(${activity}, { type: ActivityType.${action} })
^

SyntaxError: missing ) after argument list`


Repl link:
https://replit.com/@GageM1/ggjhbot-1

      client.user.setActivity(${activity}, { type: ActivityType.${action} })

This is the actual error message:

file:///home/runner/ggjhbot-1/index.js:51
      client.user.setActivity(${activity}, { type: ActivityType.${action} })
                              ^

SyntaxError: missing ) after argument list

Try

      client.user.setActivity('activity', { type: `ActivityType.${action}` })

Yeah, but I want the activity in set activity to be the constant activity.

Can You Explain More Please?

Ohhh I Understand You Now

@GageM1 Try

      client.user.setActivity(`${activity}`, { type: `ActivityType.${action}` })

use bracket notation:

      client.user.setActivity('activity', { type: ActivityType[action] })

Currently, the command doesn’t change anything.

client.user.setActivity(activity, {type: `ActivityType.${action}`});
      client.user.setStatus(status);

Now it doesn’t throw an error but doesn’t change the status. I have an ephemeral reply to show the inputs are working, and they are.

@GageM1 try this (sorry I replied to the wrong post and messed up chronology when merging the posts)

Try

if(interaction.commandName == 'status'){
// the code...

That’s what I already have.

You Made === Not ==

Still no. Logs a command was sent but doesn’t change the status.

Can You Provide A Picture Of Your Console And The Command When You Try It

:yawning_face:

What about client.user.setStatus? status and [status] don’t work.

Try

      client.user.setStatus(`${status}`)