我想编辑 discord.js 中的现有嵌入。但我收到了 message.edit
不是函数的错误。
代码:
await mongo().then(async mongoose => {
const results = await applicationSchema.findOneAndDelete({
guildId: guildId,
applicationId: applicationId
})
for (const application of results.applications) {
const { applicationId, userId, appliedfor } = application
user22 = bot.users.cache.get(userId);
let acceptembed = new Discord.MessageEmbed()
.setColor(colours.maincolour)
.setDescription(`Lieber <@${userId}>! Deine Bewerbung wurde angenommen!`)
user22.send(acceptembed)
// m = reaction.messages.cache.fetch(applicationId);
// m.edit(null, { embed: output });
let message = bot.channels.cache.get('823554343827013652').messages.fetch(applicationId)
await message.edit()
}
})
答案 0 :(得分:1)
您发送的消息应该放在 .edit()
中,就像 .send()
一样。请注意,这不会添加到消息中,而是替换它。
bot.channels.cache.get('823554343827013652').messages.fetch(applicationId)
.then(message => message.edit(acceptembed));