首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >嵌入命令(颜色) (discord.js-commando)

嵌入命令(颜色) (discord.js-commando)
EN

Stack Overflow用户
提问于 2019-03-30 22:31:44
回答 1查看 2.1K关注 0票数 0

我有一个关于嵌入命令的问题,我试图让用户在这个嵌入命令中选择颜色代码,但这是一个错误:RangeError: Argument type "colorcode" isn't registered.

我的代码:

代码语言:javascript
复制
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吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-03-30 23:57:55

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

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

您还可以转到discord.js CommandoRepository并创建一个Issue/Feature Request,建议为Color/ColorResolveable添加一个新类型。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/55432443

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档