Reputation: 9
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?
Upvotes: -1
Views: 1686
Reputation: 726
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
Upvotes: 1