Skip to content
TheChatArchiveThe Chat Archive
gpt-3.5-turbo-0613· OpenAIAi2 WildChat-4.8M (AI2)

how can i add a custom status to my bot in discord.js?

  1. User

    how can i add a custom status to my bot in discord.js?

  2. Assistant

    To add a custom status to your bot in discord.js, you can use the ClientUser.setPresence() method. Here's an example:

    const Discord = require('discord.js');
    const client = new Discord.Client();
    
    client.on('ready', () => {
        console.log(`Logged in as ${client.user.tag}`);
        
        client.user.setPresence({
            status: 'online',
            activity: {
                name: 'Custom Status',
                type: 'PLAYING', // possible values: 'PLAYING', 'STREAMING', 'LISTENING', 'WATCHING'
                url: 'https://www.twitch.tv/yourstream' // if type is 'STREAMING'
            }
        });
    });
    
    client.login('YOUR_DISCORD_BOT_TOKEN');
    

    In the above example, replace 'Custom Status' with the desired status message for your bot. You can also change 'PLAYING' to other values like 'STREAMING', 'LISTENING', or 'WATCHING' as per your requirement. If you choose 'STREAMING' as the type, you need to provide a valid streaming URL.

    Remember to replace 'YOUR_DISCORD_BOT_TOKEN' with your actual bot token.

    Once you run this code, your bot will have a custom status that displays the defined message and type.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.