Javascript 需要帮忙找到我哪里出错了吗

Javascript 需要帮忙找到我哪里出错了吗,javascript,Javascript,和机器人混在一起没有任何javascript经验,所以我无法发现哪里出了问题, 它说了一个意想不到的记号,并指向了)最后,我猜这不是问题所在,而是别的问题 const Discord = require('discord.js'); const client = new Discord.Client(); const { prefix, token } = require('./config.json'); client.once('ready', () => {

和机器人混在一起没有任何javascript经验,所以我无法发现哪里出了问题, 它说了一个意想不到的记号,并指向了)最后,我猜这不是问题所在,而是别的问题

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

const {
    prefix,
    token
} = require('./config.json');

client.once('ready', () => {
    console.log('Online');
});

client.on('message', message => {

            const args = message.content.slice(prefix.length).trim().split(' ');
            const command = args.shift().toLowerCase();
            if (!message.content.startsWith(prefix) || message.author.bot) return;

            else if (command === 'bargun') {
                message.channel.send('bargun number one siege player I get wet when I hear his name');
            } else if (command === 'siege') {
                message.channel.send('Siege is Shit Game');
            } else if (command === 'shaiiko') {
                message.channel.send('Shaiiko is the coolest guy ever i want to be him')
            } else if (command === 'kruzty') {
                message.channel.send('Kruzty is a bitch');

            } else if (command === 'cunt') {
                if (!args.length) {
                    return message.channel.send(`${message.author} is a cunt`);
                    message.channel.send(`${command}\n${args} is a cunt.`);
                };



            }); client.login(token);

在最后一个“else-if”语句后缺少“}”的位置。这应该可以

您是否有正确的
config.json
文件?请尝试放置
client.login(令牌)
before
client.once()
太棒了!请把我的答案记为答案。您还应该研究Switch语句,因为它们比许多if语句更易于使用。
const Discord = require('discord.js');
const client = new Discord.Client();

const {
    prefix,
    token
} = require('./config.json');

client.once('ready', () => {
    console.log('Online');
});

client.on('message', message => {

            const args = message.content.slice(prefix.length).trim().split(' ');
            const command = args.shift().toLowerCase();
            if (!message.content.startsWith(prefix) || message.author.bot) return;

            else if (command === 'bargun') {
                message.channel.send('bargun number one siege player I get wet when I hear his name');
            } else if (command === 'siege') {
                message.channel.send('Siege is Shit Game');
            } else if (command === 'shaiiko') {
                message.channel.send('Shaiiko is the coolest guy ever i want to be him')
            } else if (command === 'kruzty') {
                message.channel.send('Kruzty is a bitch');

            } else if (command === 'cunt') {
                if (!args.length) {
                    return message.channel.send(`${message.author} is a cunt`);
                    message.channel.send(`${command}\n${args} is a cunt.`);
                };
            }


            }); 
client.login(token);