【问题标题】:Discord.js put words in embedDiscord.js 将单词嵌入
【发布时间】:2020-12-17 11:01:47
【问题描述】:
const raidembed = new DiscordJS.MessageEmbed()
.setTitle(`Raid Target`)
.setDescription(`
Location: ${the text}
Sulfur Needed: ${the text}
`)
message.channel.send(raidembed)
如何保存消息并将它们放入嵌入中?
像这样
Bot: Location?
Me: <text>
Bot: Sulfur needed?
Me: <etc>
Bot: embed
【问题讨论】:
标签:
javascript
node.js
discord.js
【解决方案1】:
您可以使用收集器来询问用户的响应。
const collector = new Discord.MessageCollector(
message.channel,
(m) => m.author.id === message.author.id,
{ time: 100000 }
);
var location, sulfur;
collector.on("collect", (message2) => {
//asks
const colorval = message.content.toUpperCase();
location = colorval;
collector.stop();
});
此示例代码几乎等待用户响应,它会检查以确保作者与初始消息的作者相同。然后,它将用户的第二条消息保存到变量“位置”中。我已经完成了第一部分,但你所要做的只是添加另一个收集器来询问“需要硫吗?”然后您可以在代码末尾发送一条常规消息。