Search code examples
javascriptdiscordbots

How do i set my discord bot's status and presence?


I am on the latest version of discord.js. I want to set the activity as WATCHING Made By -Nightmare <3#9999. The presence is working (set as dnd) but the activity is not.

Code as of now:

client.once('ready', () => {   
    console.log('Spectre Is Now Online!');
    client.user.setPresence({
        status: "dnd",  
        game: {
            name: "Made By -Nightmare <3#9999",  
            type: "WATCHING" 
        }
    });
});

Can anyone see where I am wrong?


Solution

  • You cannot use setPresence to set activity. Presence is online/offline/dnd/away

    What you are looking for is client.user.setActivity()

    Here is an example of use:

    client.user.setActivity('Made By -Nightmare <3#9999', { type: 'WATCHING' })
    

    This sets the activity to Watching Made By -Nightmare <3#9999

    In summary:

    client.user.setPresence({status: "dnd"}); //sets presence
    client.user.setActivity('Made By -Nightmare <3#9999', { type: 'WATCHING' }); //sets activity