Possible to spawn for a single server with sharding?
I'm looking to have my bot do some specific processes in my server alone using a cron job (assigning roles based on database values, etc).
I'd prefer to save the resources of spinning up and connecting to every server & several shards when running this.
Is it possible to spawn an instance of the bot targeting a single server? Or should I just make a whole new bot for this?
Thanks in advance <:pepe_pray:1011147706539966525>
7 Replies
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Neither you nor Discord can manage which servers the shard will manage. This is done by a formula.
Gateway: Sharding
To enable sharding on a connection, the user should send the shard array in the Identify payload. The first item in this array should be the zero-based integer value of the current shard, while the second represents the total number of shards. DMs will only be sent to shard 0. To calculate be...
read more
Is it possible to know ahead of time which shard the server will be on, and only spin up that one shard?
Ah I see the formula... Perhaps I can figure it out
shard_id = (guild_id >> 22) % num_shards
Might just be easier to make a new bot though I guessDocumentation suggestion for @billytheape.eth: (static) ShardClientUtil.shardIdForGuildId()
Get the shard id for a given guild id.
You can also use this
Thank you