簡體   English   中英

Discord.js 嵌入文字

[英]Discord.js put words in embed

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

您可以使用收集器來詢問用戶的響應。

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();
});

此示例代碼幾乎等待用戶響應,它會檢查以確保作者與初始消息的作者相同。 然后,它將用戶的第二條消息保存到變量“位置”中。 我已經完成了第一部分,但你所要做的只是添加另一個收集器來詢問“需要硫嗎?” 然后您可以在代碼末尾發送一條常規消息。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM