Untitled

 avatar
unknown
plain_text
2 years ago
951 B
5
Indexable
const { Client, GatewayIntentBits } = require('discord.js');
const client = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMembers, GatewayIntentBits.MessageContent] });

const TOKEN = 'YOUR_BOT_TOKEN';
const guildId = 'YOUR_GUILD_ID'; // Sunucu (server) ID'si
const targetUsername = 'TARGET_USERNAME'; // Hedef kullanıcının Discord kullanıcı adı

client.once('ready', () => {
  console.log(`Bot olarak giriş yapıldı: ${client.user.tag}`);

  // Sunucu (server) ID'sine göre sunucuyu bulma
  const targetGuild = client.guilds.cache.get(guildId);

  // Hedef kullanıcıyı kullanıcı adına göre bulma
  const targetUser = targetGuild.members.cache.find(member => member.user.username === targetUsername);

  // Hedef kullanıcıya özel mesaj gönderme
  if (targetUser) {
    targetUser.send('Merhaba, özel mesaj!');
  } else {
    console.error('Hedef kullanıcı bulunamadı.');
  }
});

client.login(TOKEN);
Editor is loading...
Leave a Comment