My Profile Photo

Bencey's Blog

Informing the world about the application of Technology.
If you are looking for Tier III Technologies click the button below

Discord.js Multi status

Welcome everyone to the second discord.js guide. In the post, I will be showing you how you can create multiple statuses your bot.

This code contains an array of statuses that you would like the bot to display and then the bot will change statuses approx every 20 seconds.

The first thing you will need to do is add the following to the top of your index file (Or your ready file if you have an event handler)

 let statuses = ['status1', 'status2', 'status3'];

And replace with the status messages you would like.

Then you will need to add this to your ready event

     // This part of the event changes the status of the bot on a timed interval
    setInterval(function() {
        // This picks a status from an array and chooses the interval depending on how many items are in the array
        let status = statuses[Math.floor(Math.random() * statuses.length)];
            // This sets the status for the bot
            game: {
                name: status
            // This sets the status as online (Green dot)
            status: 'online'
    }, 10000)

I hope this guide helps you to create a functioning multi-status bot, If you want to see more guides like this please make sure you let me know :)