Вставить команду (цвета) (discord.js-commando) - PullRequest
0 голосов
/ 30 марта 2019

У меня проблема с командой Embed, я пытаюсь позволить пользователям выбирать цветовые коды в этой команде Embed, но у меня ошибка: RangeError: Argument type "colorcode" isn't registered..

Мой код:

const { Command } = require('discord.js-commando');
const { RichEmbed } = require('discord.js');

module.exports = class EmbedCommand extends Command {
    constructor(client) {
        super(client, {
            name: 'embed',
            group: 'extra commands',
            memberName: 'embed',
            description: 'Replies with the text you provide, But in Embed.',
            args: [
                {
                    key:"text",
                    prompt:"What Should the Embed Say?",
                    type:"string",
                },
                {
                    key:"color",
                    prompt:"What Color should the Embed be? (Use Color Codes.). Use RANDOM for Random Color. (Must Be All Caps!).",
                    type:'colorcode',
                }
            ]
        });    
    }

    run(msg, { text }) {
        msg.delete();
        let embed = new RichEmbed()
        .setTitle(text)
        .setColor(color)
        msg.embed(embed)
    }
};

.

Кто-нибудь знает, как заменить colorcode?

1 Ответ

0 голосов
/ 30 марта 2019

Вместо type:'colorcode', используйте type: 'string', и не забудьте изменить:

run(msg, { text }) { до run(msg, { text, color }) {.

Вы также можете перейти в репозиторий из discord.js Commando и создать Запрос на выпуск / функцию , чтобы рекомендовать добавить новый тип для Color/ColorResolveable.

...