0

我遇到了关于嵌入命令的问题,我试图让用户在这个嵌入命令中选择颜色代码,但这是我遇到的错误: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

4

1 回答 1

0

而不是type:'colorcode',使用type: 'string',并且不要忘记更改:

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

您还可以转到存储库discord.js Commando创建一个问题/功能请求,以推荐为Color/ColorResolveable.

于 2019-03-30T15:57:55.343 回答