如何设置机器人 activity

How to set bot activity

我无法弄清楚我必须做什么才能设置自定义游戏 activity。我尝试了几种不同的代码组合,但似乎无法正常工作。

我的代码:

bot.user.setPresence({ game: { name: 'a game' }})

在discord.js中,存在度可以这样设置:

bot.on('ready', () => {
  bot.user.setActivity('a game', { type: 'PLAYING' })
})

试试这个代码:

client.user.setActivity({ type: "PLAYING", name: `game name` })

您可以设置各种活动,例如直播、播放、观看,您的自定义 activity.This 可能会有所帮助:

client.on('ready', () => {
  console.log('Bot is online!')
 client.user.setActivity('a game', {type : 'STREAMING'} )
   })