我正在制作一个剪切编辑的不和谐机器人,但它总是显示
UnhandledPromiseRejectionWarning: DiscordAPIError: Invalid Form Body content:长度必须小于等于4000 .">
但是如果文本从一开始就没有超过4000个字符
const { MessageEmbed, Discord } = require("discord.js")
module.exports.run = async(client, message, args, Discord) => {
const esnipes = client.esnipes.get(message.channel.id)
if(!esnipes) return message.reply({ content: 'There is nothin to snipe :|'})
const esnipe = +args[0] - 1 || 0
const target = esnipes[esnipe]
if (!target) {
message.reply(`There are ${snipes.length} to snipes.`)
}
const { newc, msg } = target
new MessageEmbed()
.setAuthor(msg.author.tag, msg.author.displayAvatarURL({dynamic: true}))
.addField('old Message', msg.content)
.addField('New Content', newc.content)
message.channel.send(MessageEmbed)
}
exports.conf = {
enabled: true,
guildOnly: true,
aliase:["es"]
}
exports.help = {
name:"editsnipe",
description:"Empty",
usage:"esnipes",
category:"general"
}
这里
message.channel.send(MessageEmbed)
MessageEmbed
是一个类。您可能想使用下面的
let embed = new MessageEmbed()
.setAuthor(msg.author.tag, msg.author.displayAvatarURL({dynamic: true}))
.addField('old Message', msg.content)
.addField('New Content', newc.content)
message.channel.send({ embeds: [embed] })
//on v12 you can just use message.channel.send(embed)