Search code examples
discord.jssharding

How to show what shard the guild is using in the custom status of my bot?


So I am making a discord.js bot and I am trying to do sharding for my bot. Is there a way so that in the custom status of the bot it can show this?:

Watching Shard(the shard the guild is using)

is that possible? And if it is can you guys please help me?

Thanks!


Solution

  • You can use Guild.shardId.

    client.on("messageCreate", message => {
        if (message.author.bot) return false;
    
        message.reply(`This guild is on Shard ${message.guild.shardId}.`);
    });