我想让我的 discord.js 机器人不可见

时间:2021-02-02 11:52:23

标签: javascript node.js json discord discord.js

client.user.setStatus('invisible')
client.on('ready',  async() => {
    console.log('I am online and ready to listen to commands!')
})

那行得通吗?此外,我正在寻找一个可以执行此操作的命令,例如 ;status dnd 或 ;dnd,很确定此代码不起作用:

client.user.setStatus('dnd')
<块引用>

好的,所以我意识到错误是: https://pastebin.com/xtUZy0WW

1 个答案:

答案 0 :(得分:1)

您需要在 client.user.setStatus('invisible') 回调中调用 ready,否则 client.user 将为空。除此之外看起来不错:)

编辑:看起来像这样

client.on('ready',  async() => {
    console.log('I am online and ready to listen to commands!')
    client.user.setStatus('invisible')

})