统计频道语音

时间:2020-04-01 17:12:33

标签: javascript discord.js

您好,我希望每次启动机器人时都会更新频道,但它给我错误“消息:”无法读取未定义“”的属性“行会”

let options = {
  total: "694950461588897872",
  users: "694950483642548315",
  bots: "694950497269841920",
  afk: "694950516676886589",
  dnd: "694950563682713761",
  online: "694950576466690178",
  offline:"694950590693900329"
};

    client.on("ready", (member) => {
      //All choices are optional here. Bot wont work if the channel ID's are wrong. How to properly get ID's read in README.md 
      try {
          (options.total).setName(`????? ??????? ?: ${member.guild.memberCount}`); // You can change this text, but still keep ${guild.memberCount}, as it defines total members.
          member.guild.channels.get(options.users).setName(`?????? ?: ${message.guild.members.size - message.guild.members.filter(member => member.user.bot).size}`); // This text is also changeable, still keep the code in ${}
          member.guild.channels.get(options.bots).setName(`??? ?: ${member.guild.members.filter((m) => m.user.bot).size}`); // This text is also changeable, still keep the code in ${}
          member.guild.channels.get(options.afk).setName(`AFK ?: ${message.guild.members.filter(m => m.presence.status === 'idle').size}`)
          member.guild.channels.get(options.online).setName(`En ligne ?: : ${message.guild.members.filter(m => m.presence.status === 'online').size}`)
          member.guild.channels.get(options.offline).setName(`Hors-ligne ⚫: ${message.guild.members.filter(m => m.presence.status === 'offline').size}`)
          member.guild.channels.get(options.dnd).setName(`Ne pas déranger ?: ${message.guild.members.filter(m => m.presence.status === 'dnd').size}`)
      }
      catch (e) {   
      console.log(e);
      }
    });```

1 个答案:

答案 0 :(得分:0)

这就是您要在on ready事件中检索消息的内容。准备中没有消息。