N
N
Nikita Kudrin2020-08-07 03:28:36
Bots
Nikita Kudrin, 2020-08-07 03:28:36

How to put Discord bot status on Discord.JS 12.2.0?

Hey!
I started creating a bot for my Discord server and I don't know how to put the bot status on the new version.
Could you tell?
I looked for answers on qna.habr.com, I did not find answers.

Tried to shove discord.js from offsite

client.user.setPresence({ activity: { name: 'в novaland.js' }, status: 'idle' })
  .then(console.log)
  .catch(console.error);

But it didn't help.
Link to this code: https://discord.js.org/#/docs/main/stable/class/Cl...

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander, 2020-08-07
@HepkaPlay

the 'idle' status is set a little differently: the correct one would look like this:
bot.user.setStatus('idle')

bot.user.setPresence({
        game: {
            name: 'в novland,js ',
            type: "LISTENING",
        }
    });

the type field indicates the type, there are several varieties:
LISTENING - listens to . . .
PLAYING - plays . . .
WATCHING - looks. . .
STREAMING - stream. . . ; this type is configured using the url string:
game: {
            name: 'в novland,js ',
            type: "LISTENING",
            url: "ссылка_на_twitch_трансляцию" // <<< //
        }

but, you should understand that changing statuses is not the fastest process, so it can take quite a long time

W
Wolf_Yout, 2021-06-19
@Wolf_Yout

I don't know but my bot command is:

client.on('ready', () => {
    console.log(`Bot is ready`);
    client.user.setPresence({
        status: 'idle',
        activity: {
            type: 'PLAYING',
            name: ' Your-text',
        },
    });
});

Values ​​for type:
PLAYING -Plays
WATCHING - Watches
LISTENING - listens
For example:
type:PLAYING
name:HELP
And get Plays HELP
Values ​​status
online - Online
idle - sleeping

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question