Discord.js отправка встраивания на новый канал, который был создан, и случайное объединение 2 пользователей в битву

#node.js #discord.js

#node.js #discord.js

Вопрос:

Как добавить несколько вложений в приведенный ниже код? Я не прошу вас писать код для меня, мне просто нужны несколько советов и указаний о том, как добавлять встраивания. Поскольку я хотел бы сделать так, чтобы был создан новый канал, тогда вы получите 2 или 3 вставки, размещенные на этом канале. В одном встраивании будут указаны реакции, и я хотел бы, чтобы затем бот объединил 2 случайных игроков, чтобы они могли снова сразиться на уровне lvl.

 if (
    guild.channels.cache.find((channel) => channel.name === "t5-battle-channel")
  )
    return;

  if (reaction.emoji.name === "5️⃣") {
    let guild = reaction.message.guild;
    guild.channels.create("T5 Battle Channel", {
      //Creating the channel
      type: "text", //Make sure the channel type is text
      permissionOverwrites: [
        //Set overwrites
        {
          id: guild.id,
          deny: "VIEW_CHANNEL",
        },
        {
          id: "788400016736780338",
          allow: ["VIEW_CHANNEL"],
        },
      ],
    });
  } 

Ответ №1:

 if (
    guild.channels.cache.find((channel) => channel.name === "t5-battle-channel")
  )
    return;

  if (reaction.emoji.name === "5️⃣") {
    let guild = reaction.message.guild;
    guild.channels
      .create("T5 Battle Channel", {
        //Creating the channel
        type: "text", //Make sure the channel type is text
        permissionOverwrites: [
          //Set overwrites
          {
            id: guild.id,
            deny: "VIEW_CHANNEL",
          },
          {
            id: "788400016736780338",
            allow: ["VIEW_CHANNEL"],
          },
        ],
      })
      .then((channel) => {
        channel.send(embed).then((embedMessage) => {
          embedMessage.react("👍");
          embedMessage.react("👎");
        });
      });
  }
  let embed = new Discord.MessageEmbed()
    .setColor("#0099ff")
    .setTitle("⚔️ T5 Battles! ⚔️")
    .setDescription(
      "Please react with a Thumbs up if you want to be paired with you opponent!"
    )
    .setTimestamp()
    .setFooter("⚔️ 1657 Battles! ⚔️ | ⚔️ Managed by Ukzs⚔️");