如何在 discord.js 中*分别*更改活动标题?

how to change the activities title *Respectively* in discord.js?

嘿,我想在 discord.js 上做点什么,但不知道怎么做,我知道这是可能的,但我不知道怎么做,所以我想问你们: 我想设置我的机器人的 activity 就像它一直被改变一样 respectively 而不是 randomly。 它不应该是随机的,因为......呃......你很快就会意识到._.

这是我的activity的代码但它是随机的(我希望它分别像我说的那样):

client.on("ready") {
        console.log('Boom bot is ready to boom!')
        setInterval(() => {
            var v = (client.guilds.cache.size)
            const count = [
                "1", "2", "3", "BOOM!"]
            // here it collects the titles in randomly
            const number = Math.floor(Math.random()*(count.length))
            const activity = count[number]
            
            client.user.setActivity(activity);
        };
    })

如果这里有人知道如何分别获取number变量的数字,请考虑帮助这个人

尝试几件事:在 setInterval 函数之外声明所需的状态。还要为要执行的时间间隔设置一个以毫秒为单位的时间间隔。这是通过添加逗号和再次执行之前等待的毫秒数来完成的。在函数外部声明所需的索引,然后在函数内部在遍历整个数组后将索引重置为零。

const count = ["1", "2", "3", "BOOM!"] //removed outside
let index = 0; //declaring an index
setInterval(() => {
            // here it collects the titles in randomly
            const activity = count[index] //accessing array at index
            index++; //incrementing
            if (index >= count.length) index = 0; //resetting
            console.log(activity);
            }, 1000); //setting an interval