我在嵌入命令方面遇到问题,我试图让用户在此嵌入命令中选择颜色代码,但这是我遇到的错误: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
吗?
答案 0 :(得分:0)
使用type:'colorcode',
而不是type: 'string',
,并且不要忘记进行更改:
run(msg, { text }) {
至run(msg, { text, color }) {
。
您还可以转到discord.js Commando
的{{3}}并创建一个Repository来建议为Color/ColorResolveable
添加一个新类型。