【发布时间】:2020-11-24 11:58:04
【问题描述】:
我想将机器人的状态从播放更改为收听。
这是我的代码:
client.on("ready", () => {
console.log(`${client.user.username} ready!`);
client.user.setActivity(`${PREFIX}help`);
});
【问题讨论】:
标签: javascript node.js discord discord.js
我想将机器人的状态从播放更改为收听。
这是我的代码:
client.on("ready", () => {
console.log(`${client.user.username} ready!`);
client.user.setActivity(`${PREFIX}help`);
});
【问题讨论】:
标签: javascript node.js discord discord.js
您可以使用ClientUser.setActivity()设置活动:
client.on("ready", () => {
console.log(`${client.user.username} ready!`);
client.user.setActivity({ type: 'LISTENING' });
});
【讨论】:
client.on("ready", () => {
// This event will run if the bot starts, and logs in, successfully.
console.log(`Bot has started, with ${client.users.cache.size} users, in ${client.channels.cache.size} channels of ${client.guilds.cache.size} guilds.`);
// Example of changing the bot's playing game to something useful. `client.user` is what the
// docs refer to as the "ClientUser".
client.user.setActivity('<activity>', { type: 'LISTENING' });
});
这对我有帮助。
【讨论】: