How can I set custom status in discord bot according to new update?

Viewed 70521

According to new update youu can set your own custom status without playing or listening this is't added in documentation yet what can I do here. There is no option to set custom activity in the discord.js git see the image stable/src/util/Constants.js here too discord status image

4 Answers

You can use this code

client.on("ready", () =>{
    console.log(`Logged in as ${client.user.tag}!`);
    client.user.setPresence({
        status: "online",  //You can show online, idle....
        game: {
            name: "Using !help",  //The message shown
            type: "STREAMING" //PLAYING: WATCHING: LISTENING: STREAMING:
        }
    });
 });

You can get custom status to appear on a bot, but it won't be able to say anything. According to a Github issue on discord-api-docs, More specifically, this issue, and even more specifically, this comment on that issue. You can basically set the activity type to 4 for the client's cs by using the ClientUser.setActivity() method, and check it's full profile to see that custom status is technically available for bots.

bot.user.setActivity(`this won't appear in the bot's custom status!`, {type: 4})

Discord libaries should only be used for bots, using the API for user-account clients violates Discords Terms of Service as this is considered as API Abuse.
Moreover the recent announcement does not apply for bots, for many months Bots are able to set custom presence, including listening and watching.

To set this custom presence, the custom activity, take a look at the Discord.js Documentation here

You can set a Bot's custom activity, but I don't think you can add images or buttons to it.

Here's the closest thing I've got:

const updatePresence = async (client, state) => {
    // Set the presence
    const activity = {
        name: 'Depression',
        type: 'STREAMING',
        details: 'discord.gg/inviteCode',
        state: state,
        timestamps: {
            start: Date.now(),
        },
     };
    client.user.setPresence({
        pid: process.pid,
        activity: activity,
        status: 'online',
    });
};
Related