Опять ошибка "SyntaxError", но теперь я следую ответу на свой прошлый вопрос. - PullRequest
0 голосов
/ 03 августа 2020

Я спросил о «SyntaxError» в моем предыдущем вопросе ( Erro: SyntaxError: Unexpected token ':' в MUSI C BOT ).
Я следил за ответом, но в другом коде, и ошибка появилась снова ... Я думаю, что я ошибся в коде ...

Я следил за тем, что @Emre ответил в musi c бот, и все заработало. Но я сделал это в этом коде, и это не сработало:

const Commando = require('discord.js-commando');
const RichEmbed = require('discord.js').RichEmbed;
const Discord = require('discord.js');

class AddCommand extends Commando.Command {
    constructor(client) {
        super(client, {
            name: 'add',
            aliases: ['create', 'new', 'add-suggestion', 'suggestion', 'add-feedback', 'feedback'],
            group: 'suggestions',
            memberName: 'add',
            description: 'Add a suggestion',
            examples: ['add "Add music bot" "Please add a music bot to the server, because it\'s fun!"'],
            guildOnly: true,
            throttling: {
                usages: 2,
                duration: 60
            },
            args: [
                {
                    key: 'title',
                    prompt: 'What is the title of your suggestion?',
                    type: 'string',
                    min: 4,
                    max: 50,
                    wait: 60
                },
                {
                    key: 'description',
                    prompt: 'Please provide a description of your suggestion.',
                    type: 'string',
                    min: 10,
                    wait: 300
                }
            ],
            argsSingleQuotes: false,
        });
    }
    module.exports.run = async ((msg, args) => ({  //here what his responded for me make, put "(" before the "{"
        let channel = msg.guild.settings.get('channel');
        if (!channel || !(channel = messege.guild.channels.get(channel))) {
            msg.react('❌');
            return msg.reply('Sorry, we are not taking new suggestions for the moment.');
        }

       
        const id = msg.guild.settings.get('next_id', 1);
        const formattedId = String(id).length >= 4 ? '' + id : (String('0').repeat(4) + id).slice(-4);

        const embed = new RichEmbed();
        embed.setAuthor(`Feedback #${form.attedId}`, msg.guild.iconURL)
            .addField('Title', args.title)
            .addField('Description', args.description)
            .setFooter(`Posted by ${msg.author.username}#${msg.author.discriminator}`, msg.author.displayAvatarURL)
            .setTimestamp();

        
        const suggestion = await channel.sendEmbed(embed);
        suggestion.react('?').then(() => suggestion.react('?'));

       
        msg.guild.settings.set(`feedback#${id}`, suggestion.id);
        msg.guild.settings.set('next_id', id + 1);

      
        if (!msg.promptCount) msg.react('✅');
        let reply = 'Thanks you for your feedback.';
        if (channel.permissionsFor(msg.member).hasPermission('READ_MESSAGES')) {
            reply += ` You can see it in ${channel} (ID #${formattedId}).`;
        }

        reply = await msg.reply(reply);

        
        if (!msg.promptCount && msg.deletable && reply.deletable) {
            msg.delete(10000);
            reply.delete(10000);
        }

        return reply;
    }); //and here ")" after "}"
}

module.exports = AddCommand;

Прошу прощения за то, что все спрашиваю о все время, я очень новичок ... лол ... Если кто-то может мне помочь, я буду благодарен ...

РЕДАКТИРОВАТЬ: Извините за ошибки, я не говорю по-английски sh так много ...

1 Ответ

3 голосов
/ 03 августа 2020

Кажется, вы используете RichEmbed , который был заменен на MessageEmbed .

...