[英]Discord.js embed edit description with users reply
So I would like to know if it is possible to edit a message Embed with the user's reply.所以我想知道是否可以编辑嵌入用户回复的消息。 I will post the code below and the example.我将发布下面的代码和示例。
module.exports.run = async (Client, message, args) => {
let battleChannel = message.channel;
const filter = (m) => !m.content.length === 3;
message.reply("Please enter your alliance name... Will expire in 10 seconds...");
message.channel
.awaitMessages(filter, { max: 1, time: 10000 })
.then((collected) => {
let game = new Listing();
let editLast3 = null;
let startMessage = new Discord.MessageEmbed().setTitle("1657 Battles").setDescription("Please write your alliance.").setColor("#0099ff").setTimestamp().setFooter(`Maintained by UKzs`);
message.delete();
message.channel.send(new Discord.MessageEmbed().setTitle("1657 Battles").setDescription("").setColor("#0099ff").setTimestamp().setFooter(`Maintained by UKzs`));
})
.catch((err) => {
console.log(err);
});
};
So as you can see I have the first part then I am waiting for a response from the user so I would type the following command.start = The bot will them bot the above info and wait for me to reply = I then reply with 57kl = Is there a way to then update the embed with 57kl instead of "Please write your alliance."如您所见,我有第一部分,然后我正在等待用户的响应,因此我将输入以下命令。开始 = 机器人将他们机器人上述信息并等待我回复 = 然后我回复 57kl = 有没有办法用 57kl 而不是“请写你的联盟”来更新嵌入。
Thank you Ukzs谢谢你
You can store the embed/message you send initially:您可以存储最初发送的嵌入/消息:
const original = await message.channel.send(embed);
then edit it after you collected the message:然后在收集消息后对其进行编辑:
original.edit(newEmbed);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.