我想让我的不一致bot状态每10秒更改一次,从“监视x服务器”到“监视x用户”,这是我的代码。
client.once('ready', () => {
console.log("Conectat ca si: " + client.user.tag);
client.user.setActivity(`${client.guilds.cache.size} servere | .help`, {
type: "WATCHING",
}, 60000);
});
答案 0 :(得分:0)
client.on("ready", () => {
let currentActivity = 0;
let maxActivity = 1;
setInterval(async () => {
currentActivity++;
if (currentActivity > maxActivity) {currentActivity = 0};
switch(currentActivity) {
case 0:
client.user.setActivity(`${client.guilds.cache.size} servers.`, {type: "WATCHING"})
break;
case 1:
client.user.setActivity(`${client.users.cache.size} users.`, {type: "WATCHING"})
break;
};
}, 10000);
});