can you please help me i just need to change the bot status every 10 secs here's the code
const mySecret = process.env['token']
const Discord = require('discord.js')
const client = new Discord.Client();
client.on('ready', () => {
console.log(`Discord.js: Ready on: ${client.user.tag} ✅`)
const activitives = [
`${this.client.guildes.cache.size} servers!`,
`${this.client.channels.cache.size} channels!`,
`${this.client.guildes.cache.reduce((a,b) => a + b.memberCount, 0)} users!`,
];
let i = 0
setInterval(() => this.client.user.serActivity(`?bhelp |${activities[i++ % activities.length]}`, { type : 'LISTENING'}), 20);
})
Okay so firstly, its guild not guildes also, you have to remove the .this function
Lemme try and redefine the code so you achieve what you want
const Discord = require('discord.js')
const client = new Discord.Client();
client.on('ready', () => {
console.log(`Discord.js: Ready on: ${client.user.tag} ✅`)
const activities= [
`${client.guilds.cache.size} servers!`,
`${client.channels.cache.size} channels!`,
`${client.users.cache.size} users!`,
];
setInterval(() => {
const index = Math.floor(Math.random() * (activities.length - 1) + 1);
client.user.setActivity(`?bhelp | ${activities[index]});
}, 10000);
This should pretty much be it your logic and code was almost perfect, just a few typos and misused functions that I fixed.