#SetActivity

1 messages · Page 1 of 1 (latest)

acoustic locust
#
client.user.setActivity(client.guilds.cache.size + ' servers', { type: 'WATCHING' });```
acoustic locust
#

Right I forgot sharding exists, sorry!

unborn summit
#

not problam

acoustic locust
#

So you want the status be each shard

unborn summit
#

Yes

#

can u help me?

acoustic locust
#

and the status to be guild count of each shard?

acoustic locust
#

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

acoustic locust
#

Alright so i found out for .setActivity(nameoptions), one of the options is shardId

unborn summit
#

how?

acoustic locust
#

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

unborn summit
acoustic locust
#

No problem

unborn summit
#

i have this errors @acoustic locust

acoustic locust
#

That would make sense

#

Try putting the code in the shard_connect event

unborn summit
#

ok

charred currentBOT
acoustic locust
#

@unborn summit ^

unborn summit
#

ok wait

acoustic locust
#

Alri

unborn summit
#
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

acoustic locust
#

Does it work - is there errors?

unborn summit
#

this shard file

unborn summit
acoustic locust
#

Did you put that in client.on('shardReady')?

acoustic locust
#

That should stop the error, but again Im not sure

unborn summit
#

like this?

acoustic locust
#

yes

#

you do indent right?

#

not related, srry

acoustic locust
#

hmm

#

gtg