#SetActivity
1 messages · Page 1 of 1 (latest)
client.user.setActivity(client.guilds.cache.size + ' servers', { type: 'WATCHING' });```
but i use shard!
Right I forgot sharding exists, sorry!
not problam
So you want the status be each shard
and the status to be guild count of each shard?
yes
I'm gonna be going through the discord.js docs to see how to do this because I don't know personally, I've never had to work with sharding
ok bro im waiting
Alright so i found out for .setActivity(nameoptions), one of the options is shardId
how?
I' not sure to get the amount of guilds on a shard
client.shard.ids.forEach(shard => {
console.log(shard)
})```
That snippet of code could help in the future, try it
I'm sorry @unborn summit, I'm trying to figure this out with you
ok bro thank you very much🤍
No problem
i have this errors @acoustic locust
ok
<:_:874569322742308864> Shard#ready
Whether the shard's [Client](<https://discord.js.org/#/docs/discord.js/stable/class/Client>) is ready
@unborn summit ^
ok wait
Alri
client.shard.fetchClientValues('guilds.cache.size') .then(results => { client.user.setActivity(`${results.reduce((acc, guildCount) => acc + guildCount, 0)} Total Guilds`); }) .catch(console.error);
```
this my code how can i move to shard file? @acoustic locust
Does it work - is there errors?
Did you put that in client.on('shardReady')?
no
That should stop the error, but again Im not sure
client.on("shardReady", () => {
client.shard.fetchClientValues('guilds.cache.size') .then(results => { client.user.setActivity(`${results.reduce((acc, guildCount) => acc + guildCount, 0)} Total Guilds`); }) .catch(console.error);
})
like this?
not work@acoustic locust