这是我的密码
console.log(`Logged in as ${client.user.tag}!`);
client.user.setActivity('My Hero Academia', ({type: "WATCHING"}))
})有人知道怎么让它流吗?
发布于 2022-07-27 23:16:02
在ActivityOptions对象(setActivity()的第二个参数)中,只需将类型更改为ActivityType.Streaming (确保导入discord.js对象ActivityType),并添加另一个属性url,您可以将该属性url设置为流的url,类似于the流。例如:
// somewhere at the top of your code
const { ActivityType } = require("discord.js");
// where you set the activity
client.user.setActivity({
name: "My Hero Academia",
type: ActivityType.Streaming,
url: "https://twitch.tv/twitch_user",
});注意,您必须在setActivity options对象中具有url属性。
编辑:感谢评论中的Zsolt,如discord.js v14 you must use enums everywhere中的ActivityType.Streaming
https://stackoverflow.com/questions/73144798
复制相似问题