又是我
好吧,那么:
我试图使一个命令,将警告用户,他们加入了错误的服务器,但当我运行该命令,我得到无法发送空消息错误。
真的,任何帮助都将不胜感激!
const Discord = require("discord.js")
module.exports.run = async (client, message, args, err) => {
const embed = new Discord.MessageEmbed().setTitle('Hey!').setDescription('We think you have our server mistaken. etc etc')
if (!args[0]) return message.reply('Who?', { allowedMentions: { repliedUser: false } });
const member = message.mentions.members.first() || await message.guild.members.fetch(args[0]).catch(e => {
check = true;
return message.reply('Can\'t find specefied member! Provide a valid ID, or mention ig lol.', { allowedMentions: { repliedUser: false } });
});
message.channel.send(embed).catch(err)
message.channel.send(`${member}`)
}
错误:
DiscordAPIError: Cannot send an empty message
at RequestHandler.execute (C:\Users\stupk\Desktop\Holo\node_modules\discord.js\src\rest\RequestHandler.js:298:13)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async RequestHandler.push (C:\Users\stupk\Desktop\Holo\node_modules\discord.js\src\rest\RequestHandler.js:50:14) {
method: 'post',
path: '/channels/843567563648139317/messages',
code: 50006,
httpStatus: 400,
requestData: {
json: {
content: undefined,
tts: false,
nonce: undefined,
embeds: undefined,
components: undefined,
username: undefined,
avatar_url: undefined,
allowed_mentions: undefined,
flags: undefined,
message_reference: undefined,
attachments: undefined
},
files: []
}
}
2条答案
按热度按时间l7mqbcuq1#
从discord.js v13开始,API支持每条消息最多10个嵌入。
因此,应改为:
传入嵌入数组:
当然,您也可以只插入一个嵌入:
**更改日志:**https:discordjs.guide/additional-info/changes-in-v13.html#sending-messages-embeds-files-etc
你可能会发现一些额外的东西在那里以及。
5sxhfpxr2#
让我来帮你! 2最近很多用户都遇到了同样的错误!
代替:
执行: