【问题标题】:Disord bot status not working in discord.jsDiscord 机器人状态在 discord.js 中不起作用
【发布时间】:2020-11-23 09:03:09
【问题描述】:

我目前正在编写一个不和谐的机器人,但我的代码不起作用,我不知道为什么。

我尝试过使用各种不同的解决方案,并且搜索了很多次,但这些答案都不起作用。

我确定问题可能很简单,但我想知道是否有人可以提供帮助?

这是我的代码:

client.once('ready', () => {
    console.log('bot is online')
    client.user.setStatus('available')
    client.user.setPresence({
        game: {
            name: 'with ducks',
            type: 'PLAYING',
            url: 'https://discord.com'
        }
    })
}

【问题讨论】:

  • 您是否遇到任何错误?

标签: discord discord.js


【解决方案1】:

您需要将game 更改为activity,如Discord.js docs 所示。您也可以在.setPresence() 函数中设置状态,而不是使用.setStatus() 函数。

client.once('ready', () => {
    console.log('bot is online');

    client.user.setPresence({
        status: 'available',
        activity: {
            name: 'with ducks',
            type: 'PLAYING',
            url: 'https://discord.com'
        }
    });
});

【讨论】:

  • 非常感谢。我现在明白我的错误了,也谢谢你这么快回复,我真的很感激。
猜你喜欢
  • 2022-01-07
  • 2021-07-01
  • 2021-07-29
  • 2022-11-11
  • 2020-12-03
  • 2021-05-07
  • 2018-05-04
  • 2020-11-27
  • 2021-11-05
相关资源
最近更新 更多