首页 > 解决方案 > 如何将机器人的状态从播放更改为收听?

问题描述

我想将机器人的状态从播放更改为收听。

这是我的代码:

client.on("ready", () => {
  console.log(`${client.user.username} ready!`);
  client.user.setActivity(`${PREFIX}help`);
});

标签: javascriptnode.jsdiscorddiscord.js

解决方案


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' });
});

这帮助了我。


推荐阅读