05-04-2025, 12:06 PM
Kod paylaşımcı: furtsy#0
Sunucuya yeni giren üyeye belirtilmiş kanala buton gönderir. Kişi captcha'yı doğru bilirse rol alır.
Eğer mevcut bir mainini var ise belirli modüleri tanımlayıp ardından 17-92 satırları maininize koyabilirsiniz.
Sunucuya yeni giren üyeye belirtilmiş kanala buton gönderir. Kişi captcha'yı doğru bilirse rol alır.
Eğer mevcut bir mainini var ise belirli modüleri tanımlayıp ardından 17-92 satırları maininize koyabilirsiniz.
Kod:
const { Client, GatewayIntentBits, PermissionsBitField, ActivityType, AttachmentBuilder, ModalBuilder, TextInputBuilder, InteractionType, TextInputStyle, ChannelType, ActionRowBuilder, ButtonBuilder, ButtonStyle, EmbedBuilder,Events } = require('discord.js');
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMembers,
]
})
const wait = require('node:timers/promises').setTimeout;
const { Captcha } = require('captcha-canvas');
const { QuickDB } = require("quick.db");
const db = new QuickDB();
let rol = 'rolid' //onayladıktan sonra vermesini istediğiniz rolün idsi
let kanalid = 'kanaldi' //kişi yeni katıldığı zaman embed ve buttonu göndermek istediğiniz kanalın idsi
client.on('guildMemberAdd', async(member) => {
await member.guild.members.fetch()
let kanal = await client.channels.cache.get(kanalid)
const row = new ActionRowBuilder()
row.addComponents(
new ButtonBuilder()
.setCustomId('onay:' + member.id)
.setLabel('? | Captcha Göster')
.setStyle(ButtonStyle.Primary),
);
const embed = new EmbedBuilder()
.setColor('#5865f2')
.setAuthor({ name: `Hoşgeldin ${member.user.username}`})
.setDescription(`Kayıt olmak için captcha çözmen gerekiyor captcha çözmek için buttona tıkla!`)
.setThumbnail('https://avatars.githubusercontent.com/u/68563229?s=200&v=4')
.setImage('https://img.guildedcdn.com/TeamBanner/7e33f000e1196a1563b6c507c9aa28dd-Hero.png?w=960&h=540');
await kanal.send({ embeds: [embed], components: [row] });
});
client.on(Events.InteractionCreate, async interaction => {
if(interaction.type == 3) {
if(interaction.customId.startsWith('onay:')) {
if(interaction.customId.split(':')[1] !== interaction.user.id) return interaction.reply({ content: 'Bu butonu başkası kullanıyor', ephemeral: true })
const captcha = new Captcha();
captcha.async = false
captcha.addDecoy();
captcha.drawTrace();
captcha.drawCaptcha();
const buffer = await captcha.png;
const attachment = new AttachmentBuilder(buffer, `${captcha.text}_Captcha.png`);
const row = new ActionRowBuilder()
row.addComponents(
new ButtonBuilder()
.setCustomId('captcha:' + interaction.user.id)
.setLabel('✅ | Onayla')
.setStyle(ButtonStyle.Primary),
);
await interaction.reply({ content: 'Doğrulamayı geçmek için aşağıdaki kodu butona bastıktan sonra yaz' ,components: [row],files: [attachment], ephemeral: true});
await db.set(`captcha_${interaction.user.id}`, captcha.text)
} else if(interaction.customId.startsWith('captcha:')) {
if(interaction.customId.split(':')[1] !== interaction.user.id) return interaction.reply({ content: 'Bu butonu başkası kullanıyor', ephemeral: true })
const modal = new ModalBuilder()
.setTitle('Captcha Onaylama')
.setCustomId('Modal')
.setComponents(
new ActionRowBuilder().setComponents(
new TextInputBuilder()
.setLabel('Captcha de gördüğün kodu yaz')
.setCustomId('kod')
.setStyle(TextInputStyle.Short)
.setRequired(true)
)
);
interaction.showModal(modal);
}
} else if (interaction.type === InteractionType.ModalSubmit) {
if (interaction.customId === 'Modal') {
let kod = interaction.fields.getTextInputValue('kod')
let captcha = await db.get(`captcha_${interaction.user.id}`)
if(kod !== captcha) return interaction.reply({ content: 'Yanlış girdin', ephemeral: true });
await interaction.deferUpdate();
await wait(3000);
const embed = new EmbedBuilder()
.setColor('#388e3c')
.setDescription(`Başarılı şekilde ${interaction.member} kişisine rol verildi`);
await interaction.editReply({content: 'İşlem başarılı' ,embeds: [embed], components: [], files: [] });
await interaction.member.roles.add(rol)
}
}
});
client.login('tokeniniz');
Lord Erenify sunar...

