【问题标题】:Discord Custom Status wont showing in Discord.js v12 [closed]Discord 自定义状态未显示在 Discord.js v12 [关闭]
【发布时间】:2021-02-22 17:11:49
【问题描述】:

嘿,我想在 Discord.js 中制作一个音乐机器人并设置自定义状态,但它不起作用。有人可以帮我吗?

const Discord = require('discord.js');
const client = new Discord.Client();


client.on("ready", () =>{
    console.log(`Ready to play music! Logged in as ${client.user.tag}!`);
    client.user.setPresence({
        status: "online", 
        game: {
            name: "to your Music!, or!help",  
            type: "LISTENING"
        }
    });
 });

client.on('message', message => {
  if (message.content === 'or!ping') {
    message.channel.send(`:ping_pong: The Latency is ${Date.now() - message.createdTimestamp}ms. The API Latency is ${Math.round(client.ws.ping)}ms`);
  }
  el
});

//Token
client.login('TOKEN')

【问题讨论】:

    标签: javascript node.js api discord status


    【解决方案1】:

    如果您使用的是 v12,我假设您这样做了,您需要在设置状态时使用 right syntax

    在您的示例中,它将是 activity 而不是 game

    client.user.setPresence({
        status: "online",
        activity: {
            name: "to your Music!, or!help",
            type: "LISTENING"
        }
    });
    

    【讨论】:

      猜你喜欢
      • 2020-08-03
      • 2021-09-21
      • 2021-11-24
      • 2020-12-08
      • 1970-01-01
      • 2020-11-17
      • 1970-01-01
      • 2021-03-24
      • 1970-01-01
      相关资源
      最近更新 更多