简体   繁体   English

当我在 discord 中创建机器人时,为什么我在 Visual Studio Code 中得到“','预期的 ts1005”

[英]Why i get “ ',' expected ts1005” in Visual Studio Code when i am creating a bot in discord

im coding a discord bot and i change some field, and when i do that i have the error ',' expected ts1005 on line 75,1, can you guys check my code?,i dont know how to fix it, i try all;-;, help me, and i dont know what to say to post this because this thing its saying me the post its so much code and i dont write;-;我正在编码一个 discord 机器人,我更改了一些字段,当我这样做时,我有错误','预期 ts1005 在第 75,1 行,你们可以检查我的代码吗?,我不知道如何修复它,我尝试了所有;-;,帮帮我,我不知道该说什么来发布这个,因为这件事说我发布了这么多代码,我不写;-;

const Discord = require("discord.js");
    const client = new Discord.Client();
    let prefix = "a!"

    client.on("ready", () => {
      console.log("Ready to give Atis");
    });

    client.on("message", (message) => {
      //bucle infinito
      if (!message.content.startsWith(prefix)) return;
      if (message.author.bot) return;

      if (message.content.startsWith("ATIS JSLL")) {

        message.channel.send("ATIS For JSLL:")
        message.channel.send("Information for Airport:JSLL")
        message.channel.send("Information:Zulu")
        message.channel.send("Time:15:51:02 Z")
        message.channel.send("Active runways:22,04")
        message.channel.send("Wind:230@30")
        message.channel.send("Clouds:Scattered around 4,500feet")
        message.channel.send("Visibility:>15km")
        message.channel.send("Remarks:None")
        message.channel.send("Tower frequency:168.20")
        message.channel.send("Ground Frequency:168.30")
        message.channel.send("Delivery frequency:168.40")
        message.channel.send("Centre frequency:168.50")
        message.channel.send("Emergency frequency:168.60")

        message.channel.send("ATIS is constantly changing so please be advised all pilots in the active frequencies")
      }
      if (message.content.startsWith("ATIS JTPH")) {
        message.channel.send("ATIS For JTPH:")
        message.channel.send("Information for Airport:JTPH")
        message.channel.send("Information:Zulu")
        message.channel.send("Time:17:39:02 Z")
        message.channel.send("Active runways:09L,27R,09R,27L")
        message.channel.send("Wind:270@12")
        message.channel.send("Clouds:Scattered around 2,500feet maintaining")
        message.channel.send("Visibility:>17Km")
        message.channel.send("Remarks:None")
        message.channel.send("Tower frequency:121.20")
        message.channel.send("Ground Frequency:121.30")
        message.channel.send("Delivery frequency:121.40")
        message.channel.send("Centre frequency:121.50")
        message.channel.send("Emergency frequency:121.60")

        message.channel.send("ATIS is constantly changing so please be advised all pilots in the active frequencies")
      }
      if (message.content.startsWith(prefix + "send Emergency services")) {
        message.channel.send("Sending the emergency services to you!")
      }
      if (message.content.startsWith(prefix + "ATIS JTPH")) {
        const embed = new Discord.RichEmbed()
          .setColor("#3b83bd")
          .setDescription("This is ATIS for JTPH.")
          .setTimestamp()
          .addField("Information for Airport:JTPH.", true)
          .addField("Information:Zulu.", true)
          .addField("Time:13:29:02 Z", true)
          .addField("Active runways:09L, 09R, 27L, 27R", true)
          .addField("Wind:230@12", true
          .addField("Clouds:Clear", true)
          .addField("Visibility:>20km", true)
          .addField("Remarks:None")
          .addField("Tower frequency:121.20", true)
          .addField("Ground Frequency:121.30", true)
          .addField("Delivery frequency:121.40", true)
          .addField("Centre frequency:121.50", true)
          .addField("Emergency frequency:121.60", true)
          .addBlankField(true)
          .addField("ATIS is constantly changing so please be advised all pilots in the active frequencies", true), message.channel.send(embed)
      }
    }); client.login("<login token>")

Because you have a comma that shouldn't be here:因为你有一个不应该在这里的逗号:

,message.channel.send(embed)

It should just be:它应该只是:

message.channel.send(embed)

And you're also missing a closing parenthesis here:而且您还在这里缺少一个右括号:

.addField("Wind:230@12", true
// Should be:
.addField("Wind:230@12", true)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为什么我在一行代码中出现 TS(1005) 错误(如下)? - Why am I getting as TS(1005) error on a line of code (below)? 为什么我得到 ':' expected.ts(1005) 作为 Typescript 错误? - Why do I get ':' expected.ts(1005) as a Typescript error? 打字稿错误 TS1005: &#39;;&#39; 预期 - Typescript error TS1005: ';' expected ';' expected.ts(1005).我得到一个错误并且无法运行它 - ';' expected.ts(1005) .I get an error and cannot run it 我正在尝试在 Visual Studio Code 中使用 JavaScript 编写 discord bot,但我不断收到命令名称必须为小写的错误 - I am trying to code a discord bot with JavaScript in Visual Studio Code, but I keep getting an error that Command name must be lowercase 打字稿错误TS1005:':'预期。使用Object.assign() - Typescript error TS1005: ':' expected. with Object.assign() 错误 TS1005: ',' expected, failing to compile angular 6 project - error TS1005: ',' expected, failing to compile angular 6 project TS1005 错误,“,”预期为 simple.forEach 循环 - TS1005 error, ','expected with simple .forEach loop 我正在尝试在 Javascript 中编写一个 discord 机器人,但它一直在说“预期的声明或声明。ts(1128)” - I'm trying to code a discord bot in Javascript but it keeps saying "Declaration or statement expected. ts(1128)" 我正在创建一个不和谐的机器人,这发生了 - I am creating a discord bot and this happened
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM