Bot statuses disappear after a short while

Hey everyone, does anyone by chance know why my bot stops displaying its statuses all together? My statuses are defined in a statuses.js file. Here is my index.js file:
//LOOPS THROUGH DIFFERENT STATUSES EVERY 30 MINUTES
client.on('ready', (c) => {
console.log(`โœ… ${c.user.tag} is online!`);
setInterval(() => {
var newStatus = statuses[Math.floor(Math.random() * statuses.length)];
client.user.setActivity(newStatus);
}, 1.8e6);
});
//LOOPS THROUGH DIFFERENT STATUSES EVERY 30 MINUTES
client.on('ready', (c) => {
console.log(`โœ… ${c.user.tag} is online!`);
setInterval(() => {
var newStatus = statuses[Math.floor(Math.random() * statuses.length)];
client.user.setActivity(newStatus);
}, 1.8e6);
});
7 Replies
d.js toolkit
d.js toolkitโ€ข4mo ago
- 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!
monbrey
monbreyโ€ข4mo ago
Its a Discord thing, cant really be helped
sachoochoo
sachoochooโ€ข4mo ago
Is that so? What exactly is the "discord" thing and how can it be fixed in any way?
monbrey
monbreyโ€ข4mo ago
That presences stop being set if you keep setting them all the time They kinda time out The fix is not to have them rotate, and set the presence on login
sachoochoo
sachoochooโ€ข4mo ago
So you're saying its impossible to filter through presences and I would need to stick to one?
monbrey
monbreyโ€ข4mo ago
Someone else might know a fix, but otherwise yeah kinda Activities and statuses not working after long uptime is a known issue with Discord
sachoochoo
sachoochooโ€ข4mo ago
Unfortunate well, it works (atleast so far) but it takes some time for the statuses to kick in (i wanna say 20ish min before the first status) and then it works fine! could you show me how i would implement this? my code is above and my statuses are in a statuses.js file. require('dotenv').config(); const { ActivityType } = require('discord.js'); //TOTAL: 20 STATUSES (4 ACTIVITIES * 5 NAMES) var statuses = [ //PLAYING { name: "with my phone ๐Ÿ“ฑ", type: ActivityType.Playing }, { name: "negotiator with my alarm clock โฐ", type: ActivityType.Playing }, { name: "musical chairs with study spots ๐Ÿช‘", type: ActivityType.Playing }, { name: "DJ with my study playlists ๐ŸŽง", type: ActivityType.Playing }, { name: "chef with 2 AM microwave ramen ๐Ÿœ", type: ActivityType.Playing }, //WATCHING { name: "Khan Academy ๐ŸŒฑ", type: ActivityType.Watching }, { name: "The Organic Chemistry Tutor ๐Ÿงช", type: ActivityType.Watching }, { name: "paint dry on the wall ๐Ÿ’ค", type: ActivityType.Watching }, { name: "the stars for a sign that I'll pass โœจ", type: ActivityType.Watching }, { name: "the Wi-Fi signal perform a vanishing act ๐Ÿ›œ", type: ActivityType.Watching }, //LISTENING { name: "the symphony of the mouse clicks ๐Ÿ–ฑ๏ธ", type: ActivityType.Listening }, { name: "the echo of unchecked notifications ๐Ÿ””", type: ActivityType.Listening }, { name: "my delusions ๐Ÿ”ฎ", type: ActivityType.Listening }, { name: "the clock ticking ๐Ÿ•’", type: ActivityType.Listening }, { name: "the new album ๐ŸŽถ", type: ActivityType.Listening }, //COMPETING { name: "the autocorrect spelling bee ๐Ÿ“", type: ActivityType.Competing }, { name: "drinking the very last drop of study boba ๐Ÿง‹", type: ActivityType.Competing }, { name: "the game of \"this darned word count\" ๐Ÿ–‹", type: ActivityType.Competing }, { name: "a world of unfair deadlines ๐Ÿ", type: ActivityType.Competing }, { name: "the library for the quietest spot ๐Ÿ”‡", type: ActivityType.Competing }, ]; module.exports = statuses; In this case, where would I initialize my first status? I believe this should be set up in my index.js