【问题标题】:How can I change my bot's status from playing to listening?如何将机器人的状态从播放更改为收听?
【发布时间】: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


    【解决方案1】:

    您可以使用ClientUser.setActivity()设置活动:

    client.on("ready", () => { 
      console.log(`${client.user.username} ready!`); 
      client.user.setActivity({ type: 'LISTENING' });
    });
    

    【讨论】:

      【解决方案2】:
      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' });
      });
      

      这对我有帮助。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2021-01-11
        • 2020-12-30
        • 1970-01-01
        • 2019-05-26
        • 2020-11-06
        • 2020-12-05
        • 2021-07-06
        • 2018-02-26
        相关资源
        最近更新 更多