简体   繁体   English

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

[英]I'm looking to make my discord.js bot invisible

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

Does that work?那样有用吗? Also I'm looking for a command that will do that like;status dnd or;dnd, pretty sure this code won't work:此外,我正在寻找一个可以执行此操作的命令;status dnd 或;dnd,很确定此代码将不起作用:

client.user.setStatus('dnd')

Ok, so I realised that the error is: https://pastebin.com/xtUZy0WW好的,所以我意识到错误是: https://pastebin.com/xtUZy0WW

You need to call client.user.setStatus('invisible') within the ready callback, otherwise client.user will be null.您需要在ready回调中调用client.user.setStatus('invisible') ,否则client.user将是 null。 Other than that looks good:)除此之外看起来不错:)

EDIT: looks like this编辑:看起来像这样

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

})

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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