如何设置机器人的状态

时间:2018-03-14 19:56:00

标签: node.js streaming bots status discord.js

所以我试图让我的机器人流媒体陷入沮丧,但我尝试过多种东西而且它们不起作用。
我尝试过这些方法:

client.user.setPresence({ game: { name: 'with depression' }, status: 'online' });
bot.user.setGame('with depression', 'https://www.twitch.tv/monstercat');

这些似乎都没有按照他们应该的方式运作。任何帮助表示赞赏。

6 个答案:

答案 0 :(得分:3)

自2018年以来一直在颠簸,对不起,对不起。但是,质疑如何执行此操作的新用户需要知道游戏不再适用于此任务。

bot.user.setStatus('available')
bot.user.setPresence({
    game: {
        name: 'with depression',
        type: "STREAMING",
        url: "https://www.twitch.tv/monstercat"
    }
}

不再起作用。您现在需要执行以下操作:

bot.user.setPresence({
    status: 'online',
    activity: {
        name: 'with depression',
        type: 'STREAMING',
        url: 'https://www.twitch.tv/monstercat'
    }
})

这里引用它是因为“游戏”不再是setPresence的有效属性。读 PresenceData Documentation,以获取有关此信息的更多信息。

答案 1 :(得分:2)

.setGame已停止使用。使用:

client.user.setActivity("Game"); 

设置游戏状态。

另外,如果您使用的是早期版本的discord.js,请尝试以下操作:

client.user.setGame("Game");

在较新版本的discord.js中,不推荐使用此功能。

答案 2 :(得分:2)

在启动时启动消息的简单方法:

bot.on('ready', () => {
    bot.user.setStatus('available')
    bot.user.setPresence({
        game: {
            name: 'with depression',
            type: "STREAMING",
            url: "https://www.twitch.tv/monstercat"
        }
    });
});

您也可以在启动后在其他位置声明它,以根据需要更改消息:

bot.user.setPresence({ game: { name: 'with depression', type: "streaming", url: "https://www.twitch.tv/monstercat"}}); 

答案 3 :(得分:1)

使用此:

client.user.setActivity("with depression", {
  type: "STREAMING",
  url: "https://www.twitch.tv/monstercat"
});

答案 4 :(得分:0)

    client.user.setStatus('dnd', 'Made by KwinkyWolf') 

改变' dnd'到你希望它拥有的任何状态。然后是下一个领域'由KwinkyWolf制作'是你改变游戏的地方。希望这有助于:)

状态列表':

  • 在线
  • DND
  • 隐形

不确定他们是否仍然相同,或者是否还有更多,但希望也有所帮助:)

答案 5 :(得分:0)

setGame已停产。您必须使用client.user.setActivity

别忘了,如果您设置了流媒体状态,则必须指定一个Twitch URL

一个例子在这里:

client.user.setActivity("with depression", {
  type: "STREAMING",
  url: "https://www.twitch.tv/example-url"
});
相关问题