编辑:-原来之前的错误是由于我的命令处理程序本身!现在我明白了,这是一个很大的错误....我的意思是多个错误。嗯,所以我真的需要帮助。(PS:-对不起的麻烦!)
这个代码给了我很多错误:-
const { Discord, Client, Partials, Collection, GatewayIntentBits } = require('discord.js');
const client = new Client({ intents: [GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages] })
const { EmbedBuilder } = require('discord.js');
module.exports = {
name: 'av',
aliases: ['av'],
category: 'Util',
utilisation: '{prefix}av <mention user or dont>',
async run(client,message,args) {
console.log("test")
let member = message.mentions.users.first() || message.guild.members.cache.get(args[0]) || message.member;
let avatar = member.user.displayAvatarURL({ size: 1024, dynamic: true });
const embed = new EmbedBuilder()
.setTitle(`${member}'s Avatar`)
.setImage(avatar)
.setColor("BLACK")
.setAuthor(member);
message.channel.send({embeds: [embed]});
},
};
这是一个大错误。
{
name: 'av',
aliases: [ 'av' ],
category: 'Util',
utilisation: '{prefix}av <mention user or dont>',
run: [AsyncFunction: run]
}
av
C:\WebDev\Sutilbot\node_modules\@sapphire\shapeshift\dist\index.js:1252
return errors.length === 0 ? Result.ok(finalObject) : Result.err(new CombinedPropertyError(errors));
^
CombinedPropertyError: Received one or more errors
at ObjectValidator.handleIgnoreStrategy (C:\WebDev\Sutilbot\node_modules\@sapphire\shapeshift\dist\index.js:1252:70)
at ObjectValidator.handleStrategy (C:\WebDev\Sutilbot\node_modules\@sapphire\shapeshift\dist\index.js:1105:47)
at ObjectValidator.handle (C:\WebDev\Sutilbot\node_modules\@sapphire\shapeshift\dist\index.js:1205:17)
at ObjectValidator.parse (C:\WebDev\Sutilbot\node_modules\@sapphire\shapeshift\dist\index.js:201:88)
at EmbedBuilder.setAuthor (C:\WebDev\Sutilbot\node_modules\@discordjs\builders\dist\index.js:223:26)
at Object.run (C:\WebDev\Sutilbot\commands\av.js:19:10)
at module.exports (C:\WebDev\Sutilbot\events\messageCreate.js:14:18)
at Client.emit (node:events:524:35)
at MessageCreateAction.handle (C:\WebDev\Sutilbot\node_modules\discord.js\src\client\actions\MessageCreate.js:28:14)
at module.exports [as MESSAGE_CREATE] (C:\WebDev\Sutilbot\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32) {
errors: [
[
'name',
MissingPropertyError: A required property is missing
at ObjectValidator.handleIgnoreStrategy (C:\WebDev\Sutilbot\node_modules\@sapphire\shapeshift\dist\index.js:1227:27)
at ObjectValidator.handleStrategy (C:\WebDev\Sutilbot\node_modules\@sapphire\shapeshift\dist\index.js:1105:47)
at ObjectValidator.handle (C:\WebDev\Sutilbot\node_modules\@sapphire\shapeshift\dist\index.js:1205:17)
at ObjectValidator.parse (C:\WebDev\Sutilbot\node_modules\@sapphire\shapeshift\dist\index.js:201:88)
at EmbedBuilder.setAuthor (C:\WebDev\Sutilbot\node_modules\@discordjs\builders\dist\index.js:223:26)
at Object.run (C:\WebDev\Sutilbot\commands\av.js:19:10)
at module.exports (C:\WebDev\Sutilbot\events\messageCreate.js:14:18)
at Client.emit (node:events:524:35)
at MessageCreateAction.handle (C:\WebDev\Sutilbot\node_modules\discord.js\src\client\actions\MessageCreate.js:28:14)
at module.exports [as MESSAGE_CREATE] (C:\WebDev\Sutilbot\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32) {
property: 'name'
}
]
]
}
我无法理解这个错误。即使你能解释这个错误也足够了。
请救救我!!
1条答案
按热度按时间1l5u6lss1#
我不确定您是否正确地调用了
run
,但是关于您所指出的错误,它位于commands/av.js的第19行setAuthor
方法。问题
setAuthor
方法使用不正确。应在setAuthor
中包含name
属性溶液
不要执行以下操作,因为
member
不是字符串。换个
如果您希望拥有该图标,只需在
name
属性之后添加iconURL
属性。您只应将字符串传递给
name
属性。参考文献
String
Discord.js文档(嵌入作者)