【发布时间】:2021-12-30 19:26:38
【问题描述】:
我的机器人有问题...我收到错误消息
RangeError [EMBED_FIELD_NAME]: MessageEmbed field names must be non-empty strings.
at Function.verifyString (C:\Users\****\Documents\r-Wof-bot\node_modules\discord.js\src\util\Util.js:413:41)
at Function.normalizeField (C:\Users\****\Documents\r-Wof-bot\node_modules\discord.js\src\structures\MessageEmbed.js:479:18)
at C:\Users\****\Documents\r-Wof-bot\node_modules\discord.js\src\structures\MessageEmbed.js:501:14
at Array.map (<anonymous>)
at Function.normalizeFields (C:\Users\****\Documents\r-Wof-bot\node_modules\discord.js\src\structures\MessageEmbed.js:500:8)
at MessageEmbed.addFields (C:\Users\****\Documents\r-Wof-bot\node_modules\discord.js\src\structures\MessageEmbed.js:322:42)
at MessageEmbed.addField (C:\Users\****\Documents\r-Wof-bot\node_modules\discord.js\src\structures\MessageEmbed.js:313:17)
at Client.<anonymous> (C:\Users\****\Documents\r-Wof-bot\bot.js:2081:7)
at Client.emit (node:events:390:28)
at InteractionCreateAction.handle (C:\Users\****\Documents\r-Wof-bot\node_modules\discord.js\src\client\actions\InteractionCreate.js:70:12) { [Symbol(code)]: 'EMBED_FIELD_NAME'
}
即使字段值不为空...谁能帮助我?这是发生错误的代码的sn-p:
case 'help':
let command = interaction.options.getString('cmd', false);
if(command === null)
try{
let embed = new Discord.MessageEmbed()
.setTitle('Help')
.setColor('ORANGE')
.setFooter('Use /help cmd:<command> for more informations on that command!')
.addField({ name: 'kill', value: /*'Kills the bot. (Only available to bot-helper role)'*/'hi' }) //line 2081
.addField({ name: 'ping', value: 'Get the time delay between when you send the message and when the bot detects it.' })
.addField({ name: 'snek', value: 'snek.' })
.addField({ name: 'stalk', value: 'Get notified when the user whith the specified id logs in. Only works with this server\'s members.' })
.addField({ name: 'oc get', value: 'Get infos about an oc. Needs to have fetched the oc to the database from the message beforehand. See /help cmd:ocmessage.' })
.addField({ name: 'oc edit', value: 'Allows for the owner of the oc to edit in the database in case the data is wrong.' })
.addField({ name: 'quote', value: 'Starts a quizz about a quote. Guess the character who said that quote!' })
.addField({ name: 'fac, flip a coin', value: 'Flips a swiss coin. Warning: There is 1 in 100000000000000000 chance that the piece lands on its side. Be careful!' })
.addField({ name: 'hybridgen', value: 'A hybrid generator for you!' })
.addField({ name: 'oc message', value: 'Adds a message to the database' })
.addField({ name: 'help', valuse: 'Shows this message!' });
interaction.reply(embed);
} catch (e) {
console.warn(e);
}
}
【问题讨论】:
-
如果可能,您能否向我们展示完整的错误信息?它可能对我们有帮助
-
@MegaMix_Craft 更新
标签: javascript node.js discord discord.js