Kod Doğrulama kodu

uwu

awesomebadname
Katılım
4 Haz 2022
Mesajlar
55
Tepkime puanı
4
Şehir
Aksaray
unknown.png

Bunu discord'a geçirmeye çalıştım ve sonuç ;

unknown.png

Kod ;
JavaScript:
const {
  Client,
  MessageEmbed,
  MessageActionRow,
  MessageButton,
} = require("discord.js");
const emoji = require("node-emoji");
const config = require("./config.json");
const client = new Client({ intents: 131071 });
client.on("messageCreate", async (message) => {
  if (message.content === config.mesaj) {
    const row = new MessageActionRow().addComponents(
      new MessageButton()
        .setCustomId("test")
        .setEmoji("👌")
        .setLabel("OK")
        .setStyle("DANGER")
    );
    message.channel.send({ components: [row] });
  }
});
try {
  client.on("interactionCreate", async (interaction) => {
    if (!interaction.isButton) return;
    else if (interaction.customId === "test") {
      interaction
        .reply({
          content: "Farkı olanı seç",
          components: [button()],
          ephemeral: true,
        })
        .catch(() => console.log("e"));
    } else if (interaction.customId === "yanlis") {
      let i = interaction.guild.members.cache
        .get(interaction.member.id)
        .roles.cache.get(config.rol);
      if (i)
        interaction.guild.members.cache
          .get(interaction.member.id)
          .roles.remove(config.rol);
      interaction.update({
        content:
          "Yanlış emojiyi seçtin ve sana 600000ms timeout yetkisi verdim",
        components: [
     
        ],
      });
      interaction.member
        .timeout(600000, "Yanlış emoji")
        .catch(() => console.log("e"));
    } else if (interaction.customId === "yanlis2") {
      let i = interaction.guild.members.cache
        .get(interaction.member.id)
        .roles.cache.get(config.rol);
      if (i)
        interaction.guild.members.cache
          .get(interaction.member.id)
          .roles.remove(config.rol);
      interaction.update({
        content:
          "Yanlış emojiyi seçtin ve sana 600000ms timeout yetkisi verdim",
        components: [
     
        ],
      });
      interaction.member
        .timeout(600000, "Yanlış emoji")
        .catch(() => console.log("e"));
    } else if (interaction.customId === "yanlis3") {
      let i = interaction.guild.members.cache
        .get(interaction.member.id)
        .roles.cache.get(config.rol);
      if (i)
        interaction.guild.members.cache
          .get(interaction.member.id)
          .roles.remove(config.rol);
      interaction.update({
        content:
          "Yanlış emojiyi seçtin ve sana 600000ms timeout yetkisi verdim",
        components: [
        ],
      });
      interaction.member
        .timeout(600000, "Yanlış emoji")
        .catch(() => console.log("e"));
    } else if (interaction.customId == "dogru") {
      let i = interaction.guild.members.cache
        .get(interaction.member.id)
        .roles.cache.get(config.rol);
      if (i)
        interaction.guild.members.cache
          .get(interaction.member.id)
          .roles.remove(config.rol);
      interaction.update({
        content: "Doğru emojiyi seçtin ve seni sunucunun üyesi yaptım",
        components: []
        ],
      });
      interaction.guild.members.cache
        .get(interaction.member.id)
        .roles.add(config.rol);
    }
  });
} catch (err) {
  console.error(err);
}
client.login(config.token);
function button() {
  let dogru = emoji.random().emoji;
  let yanlış = emoji.random().emoji;
  if (yanlış === dogru) dogru = emoji.random().emoji;
  if (dogru === yanlış) yanlış = emoji.random().emoji;
  if (yanlış === dogru) dogru = emoji.random().emoji;
  if (dogru === yanlış) yanlış = emoji.random().emoji;
  const button = [
    new MessageButton()
      .setCustomId("yanlis")
      .setEmoji(`${yanlış}`)
      .setStyle("SECONDARY"),
    new MessageButton()
      .setCustomId("yanlis2")
      .setEmoji(`${yanlış}`)
      .setStyle("SECONDARY"),
    new MessageButton()
      .setCustomId("yanlis3")
      .setEmoji(`${yanlış}`)
      .setStyle("SECONDARY"),
    new MessageButton()
      .setCustomId("dogru")
      .setEmoji(`${dogru}`)
      .setStyle("SECONDARY"),
  ];

  let buton1 = button[Math.floor(Math.random() * button.length)];
  let buton2 = button[Math.floor(Math.random() * button.length)];
  let buton3 = button[Math.floor(Math.random() * button.length)];
  let buton4 = button[Math.floor(Math.random() * button.length)];
  //buton1
  if (buton1 === buton2)
    buton1 = button[Math.floor(Math.random() * button.length)];
  if (buton1 === buton3)
    buton1 = button[Math.floor(Math.random() * button.length)];
  if (buton1 === buton4)
    buton1 = button[Math.floor(Math.random() * button.length)];
  //buton2
  if (buton2 === buton1)
    buton2 = button[Math.floor(Math.random() * button.length)];
  if (buton2 === buton3)
    buton2 = button[Math.floor(Math.random() * button.length)];
  if (buton2 === buton4)
    buton2 = button[Math.floor(Math.random() * button.length)];
  //buton3
  if (buton3 === buton1)
    buton3 = button[Math.floor(Math.random() * button.length)];
  if (buton3 === buton2)
    buton3 = button[Math.floor(Math.random() * button.length)];
  if (buton3 === buton4)
    buton3 = button[Math.floor(Math.random() * button.length)];
  //buton4
  if (buton4 === buton1)
    buton4 = button[Math.floor(Math.random() * button.length)];
  if (buton4 === buton2)
    buton4 = button[Math.floor(Math.random() * button.length)];
  if (buton4 === buton3)
    buton4 = button[Math.floor(Math.random() * button.length)]; //buton1
  if (buton1 === buton2)
    buton1 = button[Math.floor(Math.random() * button.length)];
  if (buton1 === buton3)
    buton1 = button[Math.floor(Math.random() * button.length)];
  if (buton1 === buton4)
    buton1 = button[Math.floor(Math.random() * button.length)];
  //buton2
  if (buton2 === buton1)
    buton2 = button[Math.floor(Math.random() * button.length)];
  if (buton2 === buton3)
    buton2 = button[Math.floor(Math.random() * button.length)];
  if (buton2 === buton4)
    buton2 = button[Math.floor(Math.random() * button.length)];
  //buton3
  if (buton3 === buton1)
    buton3 = button[Math.floor(Math.random() * button.length)];
  if (buton3 === buton2)
    buton3 = button[Math.floor(Math.random() * button.length)];
  if (buton3 === buton4)
    buton3 = button[Math.floor(Math.random() * button.length)];
  //buton4
  if (buton4 === buton1)
    buton4 = button[Math.floor(Math.random() * button.length)];
  if (buton4 === buton2)
    buton4 = button[Math.floor(Math.random() * button.length)];
  if (buton4 === buton3)
    buton4 = button[Math.floor(Math.random() * button.length)]; //buton1
  if (buton1 === buton2)
    buton1 = button[Math.floor(Math.random() * button.length)];
  if (buton1 === buton3)
    buton1 = button[Math.floor(Math.random() * button.length)];
  if (buton1 === buton4)
    buton1 = button[Math.floor(Math.random() * button.length)];
  //buton2
  if (buton2 === buton1)
    buton2 = button[Math.floor(Math.random() * button.length)];
  if (buton2 === buton3)
    buton2 = button[Math.floor(Math.random() * button.length)];
  if (buton2 === buton4)
    buton2 = button[Math.floor(Math.random() * button.length)];
  //buton3
  if (buton3 === buton1)
    buton3 = button[Math.floor(Math.random() * button.length)];
  if (buton3 === buton2)
    buton3 = button[Math.floor(Math.random() * button.length)];
  if (buton3 === buton4)
    buton3 = button[Math.floor(Math.random() * button.length)];
  //buton4
  if (buton4 === buton1)
    buton4 = button[Math.floor(Math.random() * button.length)];
  if (buton4 === buton2)
    buton4 = button[Math.floor(Math.random() * button.length)];
  if (buton4 === buton3)
    buton4 = button[Math.floor(Math.random() * button.length)]; //buton1
  if (buton1 === buton2)
    buton1 = button[Math.floor(Math.random() * button.length)];
  if (buton1 === buton3)
    buton1 = button[Math.floor(Math.random() * button.length)];
  if (buton1 === buton4)
    buton1 = button[Math.floor(Math.random() * button.length)];
  //buton2
  if (buton2 === buton1)
    buton2 = button[Math.floor(Math.random() * button.length)];
  if (buton2 === buton3)
    buton2 = button[Math.floor(Math.random() * button.length)];
  if (buton2 === buton4)
    buton2 = button[Math.floor(Math.random() * button.length)];
  //buton3
  if (buton3 === buton1)
    buton3 = button[Math.floor(Math.random() * button.length)];
  if (buton3 === buton2)
    buton3 = button[Math.floor(Math.random() * button.length)];
  if (buton3 === buton4)
    buton3 = button[Math.floor(Math.random() * button.length)];
  //buton4
  if (buton4 === buton1)
    buton4 = button[Math.floor(Math.random() * button.length)];
  if (buton4 === buton2)
    buton4 = button[Math.floor(Math.random() * button.length)];
  if (buton4 === buton3)
    buton4 = button[Math.floor(Math.random() * button.length)];
    //bunu neden bu kadar uzun yaptım ki ...
  let buton = new MessageActionRow().addComponents(
    buton1,
    buton2,
    buton3,
    buton4,
    new MessageButton()
      .setCustomId("e")
      .setLabel("Emojiler randomdur")
      .setDisabled(true)
      .setStyle("DANGER")
  );
  return buton;
}
config.json
JSON:
{
  "rol": "ROL_ID",
  "token": "BOT_TOKEN",
  "mesaj":"LoL"
}
 
Son düzenleme:

Aventia

Aventia | Yasin
Moderator
aventia
Katılım
11 Kas 2021
Mesajlar
3,692
Tepkime puanı
1,048
Şehir
Samsun
Doğrulama değil mi bu ?
 
onwr#1000
Katılım
6 May 2022
Mesajlar
523
Tepkime puanı
105
Şehir
Antalya
unknown.png

Bunu discord'a geçirmeye çalıştım ve sonuç ;

unknown.png

Kod ;
JavaScript:
const {
  Client,
  MessageEmbed,
  MessageActionRow,
  MessageButton,
} = require("discord.js");
const emoji = require("node-emoji");
const config = require("./config.json");
const client = new Client({ intents: 131071 });
client.on("messageCreate", async (message) => {
  if (message.content === `<@${client.user.id}`) {
    const row = new MessageActionRow().addComponents(
      new MessageButton()
        .setCustomId("test")
        .setEmoji("👌")
        .setLabel("OK")
        .setStyle("DANGER")
    );
    message.channel.send({ components: [row] });
  }
});
try {
  client.on("interactionCreate", async (interaction) => {
    if (!interaction.isButton) return;
    else if (interaction.customId === "test") {
      interaction
        .reply({
          content: "Farkı olanı seç",
          components: [button()],
          ephemeral: true,
        })
        .catch(() => console.log("e"));
    } else if (interaction.customId === "yanlis") {
      let i = interaction.guild.members.cache
        .get(interaction.member.id)
        .roles.cache.get(config.rol);
      if (i)
        interaction.guild.members.cache
          .get(interaction.member.id)
          .roles.remove(config.rol);
      interaction.update({
        content:
          "Yanlış emojiyi seçtin ve sana 600000ms timeout yetkisi verdim",
        components: [
     
        ],
      });
      interaction.member
        .timeout(600000, "Yanlış emoji")
        .catch(() => console.log("e"));
    } else if (interaction.customId === "yanlis2") {
      let i = interaction.guild.members.cache
        .get(interaction.member.id)
        .roles.cache.get(config.rol);
      if (i)
        interaction.guild.members.cache
          .get(interaction.member.id)
          .roles.remove(config.rol);
      interaction.update({
        content:
          "Yanlış emojiyi seçtin ve sana 600000ms timeout yetkisi verdim",
        components: [
     
        ],
      });
      interaction.member
        .timeout(600000, "Yanlış emoji")
        .catch(() => console.log("e"));
    } else if (interaction.customId === "yanlis3") {
      let i = interaction.guild.members.cache
        .get(interaction.member.id)
        .roles.cache.get(config.rol);
      if (i)
        interaction.guild.members.cache
          .get(interaction.member.id)
          .roles.remove(config.rol);
      interaction.update({
        content:
          "Yanlış emojiyi seçtin ve sana 600000ms timeout yetkisi verdim",
        components: [
        ],
      });
      interaction.member
        .timeout(600000, "Yanlış emoji")
        .catch(() => console.log("e"));
    } else if (interaction.customId == "dogru") {
      let i = interaction.guild.members.cache
        .get(interaction.member.id)
        .roles.cache.get(config.rol);
      if (i)
        interaction.guild.members.cache
          .get(interaction.member.id)
          .roles.remove(config.rol);
      interaction.update({
        content: "Doğru emojiyi seçtin ve seni sunucunun üyesi yaptım",
        components: []
        ],
      });
      interaction.guild.members.cache
        .get(interaction.member.id)
        .roles.add(config.rol);
    }
  });
} catch (err) {
  console.error(err);
}
client.login(config.token);
function button() {
  let dogru = emoji.random().emoji;
  let yanlış = emoji.random().emoji;
  if (yanlış === dogru) dogru = emoji.random().emoji;
  if (dogru === yanlış) yanlış = emoji.random().emoji;
  if (yanlış === dogru) dogru = emoji.random().emoji;
  if (dogru === yanlış) yanlış = emoji.random().emoji;
  const button = [
    new MessageButton()
      .setCustomId("yanlis")
      .setEmoji(`${yanlış}`)
      .setStyle("SECONDARY"),
    new MessageButton()
      .setCustomId("yanlis2")
      .setEmoji(`${yanlış}`)
      .setStyle("SECONDARY"),
    new MessageButton()
      .setCustomId("yanlis3")
      .setEmoji(`${yanlış}`)
      .setStyle("SECONDARY"),
    new MessageButton()
      .setCustomId("dogru")
      .setEmoji(`${dogru}`)
      .setStyle("SECONDARY"),
  ];

  let buton1 = button[Math.floor(Math.random() * button.length)];
  let buton2 = button[Math.floor(Math.random() * button.length)];
  let buton3 = button[Math.floor(Math.random() * button.length)];
  let buton4 = button[Math.floor(Math.random() * button.length)];
  //buton1
  if (buton1 === buton2)
    buton1 = button[Math.floor(Math.random() * button.length)];
  if (buton1 === buton3)
    buton1 = button[Math.floor(Math.random() * button.length)];
  if (buton1 === buton4)
    buton1 = button[Math.floor(Math.random() * button.length)];
  //buton2
  if (buton2 === buton1)
    buton2 = button[Math.floor(Math.random() * button.length)];
  if (buton2 === buton3)
    buton2 = button[Math.floor(Math.random() * button.length)];
  if (buton2 === buton4)
    buton2 = button[Math.floor(Math.random() * button.length)];
  //buton3
  if (buton3 === buton1)
    buton3 = button[Math.floor(Math.random() * button.length)];
  if (buton3 === buton2)
    buton3 = button[Math.floor(Math.random() * button.length)];
  if (buton3 === buton4)
    buton3 = button[Math.floor(Math.random() * button.length)];
  //buton4
  if (buton4 === buton1)
    buton4 = button[Math.floor(Math.random() * button.length)];
  if (buton4 === buton2)
    buton4 = button[Math.floor(Math.random() * button.length)];
  if (buton4 === buton3)
    buton4 = button[Math.floor(Math.random() * button.length)]; //buton1
  if (buton1 === buton2)
    buton1 = button[Math.floor(Math.random() * button.length)];
  if (buton1 === buton3)
    buton1 = button[Math.floor(Math.random() * button.length)];
  if (buton1 === buton4)
    buton1 = button[Math.floor(Math.random() * button.length)];
  //buton2
  if (buton2 === buton1)
    buton2 = button[Math.floor(Math.random() * button.length)];
  if (buton2 === buton3)
    buton2 = button[Math.floor(Math.random() * button.length)];
  if (buton2 === buton4)
    buton2 = button[Math.floor(Math.random() * button.length)];
  //buton3
  if (buton3 === buton1)
    buton3 = button[Math.floor(Math.random() * button.length)];
  if (buton3 === buton2)
    buton3 = button[Math.floor(Math.random() * button.length)];
  if (buton3 === buton4)
    buton3 = button[Math.floor(Math.random() * button.length)];
  //buton4
  if (buton4 === buton1)
    buton4 = button[Math.floor(Math.random() * button.length)];
  if (buton4 === buton2)
    buton4 = button[Math.floor(Math.random() * button.length)];
  if (buton4 === buton3)
    buton4 = button[Math.floor(Math.random() * button.length)]; //buton1
  if (buton1 === buton2)
    buton1 = button[Math.floor(Math.random() * button.length)];
  if (buton1 === buton3)
    buton1 = button[Math.floor(Math.random() * button.length)];
  if (buton1 === buton4)
    buton1 = button[Math.floor(Math.random() * button.length)];
  //buton2
  if (buton2 === buton1)
    buton2 = button[Math.floor(Math.random() * button.length)];
  if (buton2 === buton3)
    buton2 = button[Math.floor(Math.random() * button.length)];
  if (buton2 === buton4)
    buton2 = button[Math.floor(Math.random() * button.length)];
  //buton3
  if (buton3 === buton1)
    buton3 = button[Math.floor(Math.random() * button.length)];
  if (buton3 === buton2)
    buton3 = button[Math.floor(Math.random() * button.length)];
  if (buton3 === buton4)
    buton3 = button[Math.floor(Math.random() * button.length)];
  //buton4
  if (buton4 === buton1)
    buton4 = button[Math.floor(Math.random() * button.length)];
  if (buton4 === buton2)
    buton4 = button[Math.floor(Math.random() * button.length)];
  if (buton4 === buton3)
    buton4 = button[Math.floor(Math.random() * button.length)]; //buton1
  if (buton1 === buton2)
    buton1 = button[Math.floor(Math.random() * button.length)];
  if (buton1 === buton3)
    buton1 = button[Math.floor(Math.random() * button.length)];
  if (buton1 === buton4)
    buton1 = button[Math.floor(Math.random() * button.length)];
  //buton2
  if (buton2 === buton1)
    buton2 = button[Math.floor(Math.random() * button.length)];
  if (buton2 === buton3)
    buton2 = button[Math.floor(Math.random() * button.length)];
  if (buton2 === buton4)
    buton2 = button[Math.floor(Math.random() * button.length)];
  //buton3
  if (buton3 === buton1)
    buton3 = button[Math.floor(Math.random() * button.length)];
  if (buton3 === buton2)
    buton3 = button[Math.floor(Math.random() * button.length)];
  if (buton3 === buton4)
    buton3 = button[Math.floor(Math.random() * button.length)];
  //buton4
  if (buton4 === buton1)
    buton4 = button[Math.floor(Math.random() * button.length)];
  if (buton4 === buton2)
    buton4 = button[Math.floor(Math.random() * button.length)];
  if (buton4 === buton3)
    buton4 = button[Math.floor(Math.random() * button.length)];
    //bunu neden bu kadar uzun yaptım ki ...
  let buton = new MessageActionRow().addComponents(
    buton1,
    buton2,
    buton3,
    buton4,
    new MessageButton()
      .setCustomId("e")
      .setLabel("Emojiler randomdur")
      .setDisabled(true)
      .setStyle("DANGER")
  );
  return buton;
}
config.json
JSON:
{
  "rol": "ROL_ID",
  "token": "BOT_TOKEN"
}
Es kanka
 
KenDayy#0001
Katılım
26 Ağu 2021
Mesajlar
247
Tepkime puanı
124
Şehir
Yurtdışı
Kanka Suriye Bayrağı Nice :D
 

Konuyu 0 kişi okuyor. (0 kayıtlı üye ve 0 ziyaretçi)

  • Bilgi