Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/413.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript discord.js-一个命令中的愚蠢错误_Javascript_Node.js_Syntax_Discord_Discord.js - Fatal编程技术网

Javascript discord.js-一个命令中的愚蠢错误

Javascript discord.js-一个命令中的愚蠢错误,javascript,node.js,syntax,discord,discord.js,Javascript,Node.js,Syntax,Discord,Discord.js,最近我通过NodeJS安装了discord.js-music。在发出命令并执行bot时,我得到以下错误: }); ^ SyntaxError: Unexpected token ) 因此,从逻辑上讲,我删除了“)”,尽管我知道这是必需的,但我得到了以下错误: }); ^ SyntaxError: Unexpected token ) 我的代码是: const Client = require('discord.js').Client; const music = require('d

最近我通过NodeJS安装了discord.js-music。在发出命令并执行bot时,我得到以下错误:

});
 ^

SyntaxError: Unexpected token )
因此,从逻辑上讲,我删除了“)”,尽管我知道这是必需的,但我得到了以下错误:

});
 ^

SyntaxError: Unexpected token )
我的代码是:

const Client = require('discord.js').Client;
const music = require('discord.js-music');

class Music extends patron.Command {
    constructor() {
        super({
            names: ['play'],
            groupName: 'general',
            description: 'joins your voice channel and plays the requested music.',
            args: [
                new patron.Argument({
                    name: 'message',
                    key: 'message',
                    type: 'message',
                    example: 'https://www.youtube.com/watch?v=DArzZ3RvejU',
                    defaultValue: patron.ArgumentDefault.message,
                    remainder: true
                })
            ]
        });
    };

    async run(msg, args) {
        if (String.isNullOrWhiteSpace(args.command)) {
            await msg.reply('you didn\'t specify the URL or search for music to play.')
            music(client);

        }
    }

检查您的代码在异步运行函数部分的第二部分中缺少一个右大括号}。

我看到两件事-您有一个带引号的右大括号(代码的倒数第二行),右大括号太少。因此,您需要取消引用其中一个,并在末尾添加另一个。@theGleep您是如何阅读此内容的?;)您知道错误指向的行吗?请注意,在编辑问题时,您可以使用{}按钮格式化代码块,现在的格式有点奇怪。我假设这两个
标记不是错误消息的一部分?将代码复制到剪贴板,在“您的答案”框中,我单击了“图片”按钮之后的“代码”按钮。粘贴到“javascript”部分并单击“tidy”。@混淆是的,BR标记是错误的:/code中缺少字符是以“简单的印刷错误”结束问题的原因