首页 > 解决方案 > 我想将我的不和谐机器人状态从播放更改为观看

问题描述

我想让我的状态为“正在观看”命令 -help”,但我不知道如何将其从播放切换为观看,

这是我的代码:

command(client, 'status', (message) => {
    if (message.author.id != "my id goes here") return;    
    const content = message.content.replace('-status ', '')

    client.user.setPresence({
        activity: {
            name: content,
            type: 0,
        },
    })
})

标签: discorddiscord.js

解决方案


您需要设置代码:

    client.user.setPresence({
        status: 'online', //you can set online , idle , dnd and offline
        activity: {
            name: 'Some Name',
            type: 'PLAYING', //here you can change it to 'WATCHING' , 'PLAYING' , STREAM,
            url: 'https://discord.com'
        }
    });

有关更多信息,您可以在此处查看


推荐阅读