为什么我的node.js中的不和谐机器人在}上显示错误?

时间:2019-05-15 13:50:50

标签: node.js

我正在使用node.js创建一个新的discord机器人,但出现一个我不明白为什么的错误。 要查看整个代码,请访问: https://repl.it/@Make_True/ShortMinigames-discord-bot

我是编程新手,所以我不知道这是怎么回事。

client.on('message', message => {
  if (message.content === 'What is ShortMinigames?') {
message.channel.send({
  embed: {
    "title": "What is ShortMinigames?",
    "description": "ShortMinigames is a Minecraft minigames server currently Offline for the public. We are currently planning to release PVP, Bedwars, Skywars, Parkour, Capture the Flag and build battle.",
    "color": 6334225,
    "timestamp": "2019-05-11T07:06:44.314Z",
    "footer": {
      "icon_url": "https://i.ibb.co/WVXy4rJ/Short-Minigameslogo.png",
      "text": "ShortMinigames"
    },
    "thumbnail": {
      "url": "https://i.ibb.co/WVXy4rJ/Short-Minigameslogo.png"
    },
    "author": {
      "name": "Written by: Make True",
      "icon_url": "https://i.ibb.co/5xFvYK3/j-k-p.png"
    },
    "fields": [
      {
        "name": "What version is ShortMinigames running on?",
        "value": "Currently we are on minecraft 1.14."
      },
      {
        "name": "How can I apply for staff/builder?",
        "value": "To apply use the command -apply in #:computer:commands, also to find out more information about applying for staff/builder."
      },
      {
        "name": "What is the server IP?",
        "value": "Sorry but we are still offline for the public. The server ip will be released to the public as we finnaly come online"
      },
      {
        "name": "Any more questions?",
        "value": "If you have any questions then please ask them in #:sos:support and we will try to answer it as quickly and accurately as possible. Thank you for your understanding and your patience and we hope to see you soon!"
      }
    ]
  }
}

1 个答案:

答案 0 :(得分:0)

您没有关闭 ) 命令的 send,对于 }) 语句的 if 也是如此,并且您忘记了} 方法的 client.on

client.on('message', message => {
    if (message.content === 'What is ShortMinigames?') {
  message.channel.send({
    embed: {
      "title": "What is ShortMinigames?",
      "description": "ShortMinigames is a Minecraft minigames server currently Offline for the public. We are currently planning to release PVP, Bedwars, Skywars, Parkour, Capture the Flag and build battle.",
      "color": 6334225,
      "timestamp": "2019-05-11T07:06:44.314Z",
      "footer": {
        "icon_url": "https://i.ibb.co/WVXy4rJ/Short-Minigameslogo.png",
        "text": "ShortMinigames"
      },
      "thumbnail": {
        "url": "https://i.ibb.co/WVXy4rJ/Short-Minigameslogo.png"
      },
      "author": {
        "name": "Written by: Make True",
        "icon_url": "https://i.ibb.co/5xFvYK3/j-k-p.png"
      },
      "fields": [
        {
          "name": "What version is ShortMinigames running on?",
          "value": "Currently we are on minecraft 1.14."
        },
        {
          "name": "How can I apply for staff/builder?",
          "value": "To apply use the command -apply in #:computer:commands, also to find out more information about applying for staff/builder."
        },
        {
          "name": "What is the server IP?",
          "value": "Sorry but we are still offline for the public. The server ip will be released to the public as we finnaly come online"
        },
        {
          "name": "Any more questions?",
          "value": "If you have any questions then please ask them in #:sos:support and we will try to answer it as quickly and accurately as possible. Thank you for your understanding and your patience and we hope to see you soon!"
        }
      ]
    }
  })
}})