当我在不一致的地方创建Bot时,为什么在Visual Studio Code中会出现“','预期为ts1005”

时间:2019-11-05 19:01:51

标签: javascript bots embed discord discord.js

我正在编码一个不和谐的bot,我改变了一些字段,当我这样做时,我遇到了错误','预期在75,1行上会出现ts1005,你们能检查我的代码吗?,我不知道如何解决它,我尽力了;-;,帮帮我,我不知道该说些什么,因为这个东西在说我发表了这么多的代码,我也不写;-;

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>")

1 个答案:

答案 0 :(得分:1)

因为您的逗号不应该在这里:

,message.channel.send(embed)

应该是:

message.channel.send(embed)

您在这里也缺少右括号:

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