简体   繁体   中英

setPresence activity type in discord.js v14 can only be set to "PLAYING"

When I try to set the status of the bot, I do not know the type, basically, there are 4 ways: PLAYING , WATCHING , LISTENING , and STREAMING . But I can't set anything else, I can only use the default PLAYING .

Am I inattentive or can't really be like that in the newer update?

client.user.setPresence({ activities: [{ name: `discord.js v14`, type: `WATCHING` }], status: 'dnd' })

In v14, you will need to use the ActivityType enums or numbers.

You can import it from discord.js :

const { Client, GatewayIntentBits, ActivityType } = require('discord.js');

And use it like this:

client.user.setPresence({
  activities: [{ name: `discord.js v14`, type: ActivityType.Watching }],
  status: 'dnd',
});

List of ActivityType s:

v13 v14 v14 value
"COMPETING" ActivityType.Competing 5
"LISTENING" ActivityType.Listening 2
"PLAYING" ActivityType.Playing 0
"STREAMING" ActivityType.Streaming 1
"WATCHING" ActivityType.Watching 3

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM