Discord Bot ile Otomatik Rol Verme Sistemi

Discord Bot ile Otomatik Rol Verme Sistemi

NBK BARIS1 Mayıs 2026Discord-bot-kodlari, JavaScript

Discord sunucularinda yeni uyelere otomatik rol vermek sunucu yonetimini kolaylastirir.

Yeni Uyeye Otomatik Rol

// (c) CodeMareFi - codemarefi.com.tr
client.on('guildMemberAdd', async member => {
  const rolId = 'ROL_ID_BURAYA';
  const rol = member.guild.roles.cache.get(rolId);
  if (!rol) return;
  try {
    await member.roles.add(rol);
    await member.send({ embeds: [{ color: 0xe60000, title: 'Sunucuya Hos Geldin!', description: 'Dogrulama yapman gerekiyor.', footer: { text: 'CodeMareFi' } }] });
  } catch (err) { console.error(err); }
});

Reaksiyon ile Rol Verme

// (c) CodeMareFi - codemarefi.com.tr
const MESAJ_ID = 'MESAJ_ID';
const ROL_ID = 'ROL_ID';
client.on('messageReactionAdd', async (reaction, user) => {
  if (user.bot || reaction.message.id !== MESAJ_ID) return;
  const member = reaction.message.guild.members.cache.get(user.id);
  const rol = reaction.message.guild.roles.cache.get(ROL_ID);
  if (member && rol) await member.roles.add(rol);
});
© CodeMareFi Bu icerik codemarefi.com.tr ye aittir.

0 Yorum

YORUM YAPMAK İÇİN SİSTEME SIZMANIZ GEREKİYOR

Lütfen yukarıdaki butonu kullanarak giriş yapın veya kimlik oluşturun.

Yorumlar yükleniyor...