-1

this is my code

    console.log(`Logged in as ${client.user.tag}!`);
    client.user.setActivity('My Hero Academia', ({type: "WATCHING"}))
})

does anyone know how to make it streaming?

  • Does this answer your question? [setPresence activity type in discord.js v14 can only be set to "PLAYING"](https://stackoverflow.com/questions/73049373/setpresence-activity-type-in-discord-js-v14-can-only-be-set-to-playing) – Zsolt Meszaros Jul 28 '22 at 05:56
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Jul 28 '22 at 08:45

1 Answers1

1

In the ActivityOptions object (the second parameter of setActivity()), just change the type to ActivityType.Streaming (make sure to import the discord.js object ActivityType), and add another property url, which you set to the url of the stream, like a Twitch stream. For example:

// somewhere at the top of your code
const { ActivityType } = require("discord.js");

// where you set the activity
client.user.setActivity({
    name: "My Hero Academia",
    type: ActivityType.Streaming,
    url: "https://twitch.tv/twitch_user",
});

Note that you must have the url property in the setActivity options object.

Edit: Thanks to Zsolt Meszaros in the comments, in discord.js v14 you must use enums everywhere, for example, ActivityType.Streaming

isaac.g
  • 681
  • 1
  • 4
  • 12
  • 1
    _"I'm not even sure why you need to use the `ActivityType.Streaming` object[...]"_ In discord.js v14, strings no longer work and you have to [use enums everywhere](https://stackoverflow.com/a/73028855/6126373) – Zsolt Meszaros Jul 28 '22 at 10:48
  • Oh I see, I haven't used v14 much yet so thanks for the info – isaac.g Jul 28 '22 at 19:33