Reputation: 23
The part that I am struggling to change is: I am trying to change it from being "Playing Watching 50 members!" to just "watching 50 members!" but it still having an interval between the first status. I think the difference would be just to change "const activities = [" to "const something else = [" because the "activities" part automatically adds the "Playing" prefix and I would want it to be Watching or just nothing. Here is the entire code, I've also included it in the image:
client.login(process.env.token)
const activities_list = [
"Playing",
"Watching"
];
client.on("ready", async() => {
console.log("Bot is truly online!")
let servers = await client.guilds.cache.size
let servercount = await client.guilds.cache.reduce((a,b) => a+b.memberCount, 0 )
const activities = [
`MARK'S NEW VIDEO | ${servers} servers`,
`Watching ${servercount} members!
]
setInterval(()=>{
const status = activities[Math.floor(Math.random()*activities.length)]
client.user.setPresence({ activities : [{name : `${status}`}]})
}, 3000)
})
Upvotes: 2
Views: 2238
Reputation: 992
When you set the status to Watching ${servercount} members!
that will be the whole message for the status. To change it to another kind (playing
, online
etc) in the .setPresence
to { type: activityType }
. For example this is what the code would looks like.
const activities = [
[`PLAYING`, `MARK'S NEW VIDEO | ${servers} servers`],
[`WATCHING`, `${servercount} members!`]
]
setInterval(()=>{
const randomIndex = Math.floor(Math.random()*activities.length)
const activityType = activities[randomIndex][0]
const activity = activities[randomIndex][1]
client.user.setPresence({ activities: [{ name: activity, type: activityType }]});
}, 3000)
Upvotes: 1