skip to Main Content

My Discord bot does not show the activity status I have tried several methods but none worked my current code looks like this.

client.once('ready', () => {
  try {
    client.user.setActivity('Test', { type: 'PLAYING' });
    console.log(`Bot's Status: successfully updated`);
  } catch (error) {
    console.error(`Bot's Status: error while updating status`, error);
  }
});

I am using node.js v18.18.1
and discord.js the latest version

I have already tried with .setPresence see below but it did not work either.

client.once('ready', async () => {
  try {
    client.user.setPresence({
      status: 'online',
      activity: {
        name: 'Test',
        type: 'PLAYING'
      }
    });
    console.log(`Bot's Status: successfully updated`)
  } catch (error) {
    console.error(`Bot's Status: error while updating status`)
  }
});

So either I’m not awake enough or it just doesn’t work the bot has got adminesstrator rights has already been kicked and reloaded and the token has been reset but it still doesn’t work.

2

Answers


  1. If you’re using the latest version of discord.js then the examples you showed are no longer valid (they used to work before like 2 major versions behind).

    Right now, for you to change the presence, you should:

    import { ActivityType } from 'discord.js'; // Top of the file
    
    client.user.setPresence(
      activities: [{ name: 'Test', type: ActivityType.Playing }],
      status: 'online'
    );
    

    For more info, check out the setPresence() method’s documentation.

    Login or Signup to reply.
  2. "type: ‘PLAYING’" is no longer available in discord.js v14 you would need to use the number values or ActivityType Enums

    const {ActivityType} = require("discord.js");
    
    await client.user.setPresence({
            activities: [{ name: `Test`, type: ActivityType.Playing}],
            status: "online",
        });
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search