Ask coding questions

← Back to all posts
Bot status
RyanJackson3 (10)

So I am currently scripting a discord bot using node.js but I cannot figure out how to make a bot status similar to this

I would really appreciate if anyone can tell me how to do this. Thanks!


you can use this piece of code here.

client.on("ready", () => {
  // This event will run if the bot starts, and logs in, successfully.
  console.log(`Bot has started, with ${client.users.cache.size} users, in ${client.channels.cache.size} channels of ${client.guilds.cache.size} guilds.`);
  // Example of changing the bot's playing game to something useful. `client.user` is what the
  // docs refer to as the "ClientUser".
  client.user.setActivity(`Serving ${client.guilds.cache.size} servers`);

In the last line you can put whatever status you want.

retronbv (131)

client.on('ready', () => {
client.user.setPresence({ game: { name: 'with discord.js' }, status: 'idle' })
console.log(${client.user.username} is up and running!);

RyanJackson3 (10)

@retronbv So I used the code you gave me. When I ran it it said "client not defined" so I modified the code to this

bot.on('ready', () => {
bot.user.setPresence({ WATCHING: { name: '!help' }, status: 'online' });
console.log(`[READY] ${bot.user.tag} has been successfully booted up!`);

The bot was able to start up but the status didn't show on the bot. Can you help with that?

RyanJackson3 (10)

@RyanJackson3 Never mind. I have recently discovered that game is no longer supported.

retronbv (131)

game is still supported i think