设置机器人的自定义状态

问题描述 投票:0回答:2

有什么方法可以将漫游器的状态设置为自定义状态?

我到处都看过网上,但找不到discord.js的任何文档。

我发现

https://stackoverflow.com/questions/61754610/how-to-set-bots-custom-status-with-discord-py

对于discord.py,但是我不确定这是否是我想要的,以及那是python而不是JavaScript。

discord.js
2个回答
0
投票

如果您的意思是this然后您可以插入此代码

bot.user.setActivity(`custom status`, {
        type: 'PLAYING' // you can set this to PLAYING, WATCHING, LISTENING or STREAMING
    }); // you may have "client" instead of "bot"

[无论您要设置自定义状态的位置,例如,如果您要在bot准备就绪时进行设置,请将其添加到bot.on(“ ready”)函数中]

bot.on("ready", async () => {
    // add it here
}); //again you may have client instead of bot

0
投票

唯一可用的状态类型是:

  1. 在线
  2. dnd
  3. idle
  4. 不可见

关于自定义状态,您将无法使用它,因为它不会显示任何状态如果您想尝试,我会给您代码

client.user.setPresence({activity: {type: 'CUSTOM_STATUS', name: "Chilling"}, status: 'online'}).then(console.log).catch(console.error);
© www.soinside.com 2019 - 2024. All rights reserved.