简体   繁体   中英

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:

client.user.setStatus('dnd')

Ok, so I realised that the error is: https://pastebin.com/xtUZy0WW

You need to call client.user.setStatus('invisible') within the ready callback, otherwise client.user will be 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')

})

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