Bu konu çözüldü olarak işaretlenmiştir. Çözülmediğini düşünüyorsanız konuyu rapor edebilirsiniz.
Katılım
15 Aralık 2023
Mesajlar
2.754
Makaleler
3
Çözümler
27
Beğeniler
2.651
Yer
Avcılar/İstanbul
Kodumu ve hatayı aşağıda belirttim. Özellikleri: Yazıtura komudu olacak, rastgele yazı tura atacak. .AFK sebep komudu olacak, birisi AFK olan kullanıcıyı yanıtlarsa şu sebepten şu süre boyunca AFK yazacak. Kullanıcı AFK mesajından sonra bir mesaj yazarsa AFK modundan otomatik çıkacak, ne kadardır AFK olduğunu vs. söyleyecek. AFK mesajları da embed ile gelecek. Bunu Discord'un komut özelliği ile yapacak, modernize görünecek. "güno" veya "guno" içeren bi' kelime yazılırsa "Günaydın!" yazacak. "helü" veya "helu" içeren kelime yazılırsa "Merhaba!" yazacak. Botun boşta, online veya rahatsız etme modunu ayarlamak için. Durum komudu olacak. Örneğin. Durum idle yazınca boşta olacak. Botun etkinliğinde "komi-san can't communicate izliyor" yazacak. Mümkünse sil komudunu da ayarlamak istiyorum, dünden beri çalışmıyor. Bu arada sorunum komutlar bazen çalışıyor bazen çalışmıyor, kalıcı çalıştırmak istiyorum.


[CODE title="Kod"]const Discord = require('discord.js');
const { Client, Intents } = Discord;

// AFK ve AFK mesajı için değişkenler
let afkUsers = {};
let afkMessage = "AFK: {reason} ({duration} dakika)";

// Bot tokenı (ortam değişkeninden veya güvenli yöntemden yükleyin)
const BOT_TOKEN = process.env.BOT_TOKEN;

// Bot kurulumu
const client = new Client({ intents: [Intents.FLAGS.GUILDS] });

// Yazı tura komutu
client.on('message', async message => {
if (message.content === '.yazıtura') {
const coin = ['Yüz', 'Tura'];
const randomCoin = coin[Math.floor(Math.random() * coin.length)];
const embed = new Discord.MessageEmbed()
.setTitle('Yazı Tura')
.setDescription(**Kazanan:** ${randomCoin})
.setColor(randomCoin === 'Yüz' ? '#00ff00' : '#ff0000'); // Renkleri Yüz için yeşil, Tura için kırmızı yapar
message.channel.send({ embeds: [embed] });
}
});

// AFK komutu
client.on('message', async message => {
if (message.content.startsWith('.afk')) {
const reason = message.content.slice(4);
if (!reason) return message.channel.send('Lütfen AFK olma sebebinizi girin.');

afkUsers[message.author.id] = {
reason,
startTime: Date.now()
};

const embed = new Discord.MessageEmbed()
.setTitle('AFK')
.setDescription(**Kullanıcı:** ${message.author.username}\n**Sebep:** ${reason})
.setColor('#ff0000'); // AFK iken kırmızı
message.channel.send({ embeds: [embed] });
}
});

// AFK mesajı ve otomatik AFK çıkışı
client.on('message', async message => {
if (afkUsers[message.author.id]) {
const afkUser = afkUsers[message.author.id];
const afkDuration = Math.floor((Date.now() - afkUser.startTime) / 60000);

if (message.author !== afkUser.id) {
const embed = new Discord.MessageEmbed()
.setTitle('AFK Modundan Çıkış')
.setDescription(**Kullanıcı:** ${message.author.username}\n**Sebep:** ${afkUser.reason}\n**Süre:** ${afkDuration} dakika)
.setColor('#00ff00'); // AFK'dan çıkınca yeşil
message.channel.send({ embeds: [embed] });
delete afkUsers[message.author.id];
message.channel.send(AFK modundan çıktınız. (${afkDuration} dakika afk oldunuz));
}
}
});

// Günaydın ve Merhaba mesajları
client.on('message', async message => {
if (message.content.toLowerCase().includes('güno') || message.content.toLowerCase().includes('guno')) {
const embed = new Discord.MessageEmbed()
.setDescription('Günaydın!')
.setColor('#ffff00'); // Sarı renk
message.channel.send({ embeds: [embed] });
} else if (message.content.toLowerCase().includes('helü') || message.content.toLowerCase().includes('helu')) {
const embed = new Discord.MessageEmbed()
.setDescription('Merhaba!')
.setColor('#ffff00'); // Sarı renk
message.channel.send({ embeds: [embed] });
}
});

// Durum komutu
client.on('message', async message => {
if (message.content.startsWith('.durum')) {
const status = message.content.slice(7).toLowerCase();

if (status === 'idle') {
client.user.setActivity('Boşta', { type: 'PLAYING' });
const embed = new Discord.MessageEmbed()
.setDescription('Durumunuz boşta olarak ayarlandı.')
.setColor('#00ff00'); // Yeşil renk
message.channel.send({ embeds: [embed] });
} else if (status === 'online') {
client.user.setActivity(null);
const embed = new Discord.MessageEmbed()
.setDescription('Durumunuz çevrimiçi olarak ayarlandı.')
.setColor('#00ff00'); // Yeşil renk
message.channel.send({ embeds: [embed] });
} else if (status === 'dnd') {
client.user.setActivity('Rahatsız Etmeyin', { type: 'PLAYING' });
const embed = new Discord.MessageEmbed()
.setDescription('Durumunuz rahatsız etme olarak ayarlandı.')
.setColor('#ff0000'); // Kırmızı renk
message.channel.send({ embeds: [embed] });
} else {
const embed = new Discord.MessageEmbed()
.setDescription('Geçersiz durum. Lütfen idle, online veya dnd girin.')
.setColor('#ff0000'); // Kırmızı renk
message.channel.send({ embeds: [embed] });
}
}
});

// Etkinlik mesajı
client.user.setActivity('Komi-San Can't Communicate İzliyor', { type: 'WATCHING' });

TOKEN GİZLİ
[/CODE]

[CODE title="Hata"]C:\dcbot\Komisan\index.cjs:12
const client = new Client({ intents: [Intents.FLAGS.GUILDS] });
^

TypeError: Cannot read properties of undefined (reading 'FLAGS')
at Object.<anonymous> (C:\dcbot\Komisan\index.cjs:12:47)
at Module._compile (node:internal/modules/cjs/loader:1358:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
at Module.load (node:internal/modules/cjs/loader:1208:32)
at Module._load (node:internal/modules/cjs/loader:1024:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:174:12)
at node:internal/main/run_main_module:28:49

Node.js v20.15.0[/CODE]

@Vavien.[/embed][/embed][/embed][/embed][/embed][/embed][/embed][/embed][/embed]
 
Son düzenleyen: Moderatör:
Çözüm
@sahnelerde Hocam bu sefer de AFK'dan çıktınız mesaj atmadan çalışıyor ama ayarlayabilirim sanırım, çok teşekkürler.

Bota birkaç özellik ekledim, hemen çalışan scripti atıyorum.

Çözümü buldum arkadaşlar, Discord.JS sürümünü 12.5.3 yapıp şu komutları kullanınca botum çalışıyor:

Kod:
const Discord = require('discord.js');
const client = new Discord.Client();

const PREFIX = '.'; // Komutların prefix'i
const AFK = new Map(); // AFK kullanıcılarını saklamak için

client.on('ready', () => {
    console.log(`Logged in as ${client.user.tag}!`);
    client.user.setActivity('Komi-San Can\'t Communicate İzliyor');
});

client.on('message', message => {
    if (message.author.bot) return;

    // Yazı Tura Komutu
    if (message.content.startsWith(`${PREFIX}yazıtura`)) {
        const result = Math.random() < 0.5 ? 'Yazı' : 'Tura';
        const embed = new Discord.MessageEmbed()
            .setTitle('Yazı Tura')
            .setDescription(result)
            .setColor('#00ff00');
        message.channel.send(embed);
    }

    // AFK Komutu
    if (message.content.startsWith(`${PREFIX}afk`)) {
        const reason = message.content.split(' ').slice(1).join(' ') || 'Sebep belirtilmedi';
        AFK.set(message.author.id, { reason: reason, time: Date.now() });
        const embed = new Discord.MessageEmbed()
            .setTitle('AFK Moduna Geçildi')
            .setDescription(`**Sebep:** ${reason}`)
            .setColor('#ff0000');
        message.channel.send(embed);
        return;
    }

    // AFK Modundan Çıkma
    if (AFK.has(message.author.id)) {
        const afkInfo = AFK.get(message.author.id);
        const afkTime = (Date.now() - afkInfo.time) / 1000;
        AFK.delete(message.author.id);
        const embed = new Discord.MessageEmbed()
            .setTitle('AFK Modundan Çıkıldı')
            .setDescription(`AFK modundan çıktınız. AFK süresi: ${Math.round(afkTime)} saniye.`)
            .setColor('#00ff00');
        message.channel.send(embed);
    }

    // AFK Kullanıcılarını Kontrol Etme
    message.mentions.users.forEach(user => {
        if (AFK.has(user.id)) {
            const afkInfo = AFK.get(user.id);
            const afkTime = (Date.now() - afkInfo.time) / 1000;
            const embed = new Discord.MessageEmbed()
                .setTitle(`${user.tag} AFK`)
                .setDescription(`**Sebep:** ${afkInfo.reason}\n**Süre:** ${Math.round(afkTime)} saniye`)
                .setColor('#ff0000');
            message.channel.send(embed);
        }
    });

    // Günaydın ve Merhaba Mesajları
    if (message.content.toLowerCase().includes('güno') || message.content.toLowerCase().includes('guno')) {
        message.channel.send('Günaydın!');
    }

    if (message.content.toLowerCase().includes('helü') || message.content.toLowerCase().includes('helu')) {
        message.channel.send('Merhaba!');
    }

    // Durum Komutu
    if (message.content.startsWith(`${PREFIX}durum`)) {
        const status = message.content.split(' ')[1];
        if (status === 'online' || status === 'idle' || status === 'dnd' || status === 'invisible') {
            client.user.setStatus(status);
            const embed = new Discord.MessageEmbed()
                .setTitle('Durum Değiştirildi')
                .setDescription(`Durumunuz ${status} olarak değiştirildi.`)
                .setColor('#00ff00');
            message.channel.send(embed);
        } else {
            const embed = new Discord.MessageEmbed()
                .setTitle('Geçersiz Durum')
                .setDescription('Geçersiz durum. Durumlar: online, idle, dnd, invisible')
                .setColor('#ff0000');
            message.channel.send(embed);
        }
    }

    // Mesaj Silme Komutu
    if (message.content.startsWith(`${PREFIX}sil`)) {
        const args = message.content.split(' ').slice(1);
        const amount = parseInt(args[0]);
        if (!amount || isNaN(amount) || amount < 1 || amount > 100) {
            const embed = new Discord.MessageEmbed()
                .setTitle('Geçersiz Sayı')
                .setDescription('Lütfen 1 ile 100 arasında bir sayı belirtin.')
                .setColor('#ff0000');
            return message.channel.send(embed);
        }
        message.channel.bulkDelete(amount + 1, true).catch(err => {
            console.error(err);
            const embed = new Discord.MessageEmbed()
                .setTitle('Hata')
                .setDescription('Mesajları silerken bir hata oluştu.')
                .setColor('#ff0000');
            message.channel.send(embed);
        });
    }

    // Sayı Tutma Komutu
    if (message.content.startsWith(`${PREFIX}tutsayi`)) {
        const args = message.content.split(' ').slice(1);
        const min = parseInt(args[0]);
        const max = parseInt(args[1]);
        if (isNaN(min) || isNaN(max) || min >= max) {
            const embed = new Discord.MessageEmbed()
                .setTitle('Geçersiz Aralık')
                .setDescription('Lütfen geçerli bir sayı aralığı belirtin. Örneğin: .tutsayi 1 100')
                .setColor('#ff0000');
            return message.channel.send(embed);
        }
        const randomNum = Math.floor(Math.random() * (max - min + 1)) + min;
        const embed = new Discord.MessageEmbed()
            .setTitle('Rastgele Sayı')
            .setDescription(`Seçilen sayı: ${randomNum}`)
            .setColor('#00ff00');
        message.channel.send(embed);
    }

    // Yardım Komutu
    if (message.content.startsWith(`${PREFIX}yardım`)) {
        const embed = new Discord.MessageEmbed()
            .setTitle('Komut Listesi')
            .setDescription(`Tüm komutları görmek için: ${PREFIX}yardım`)
            .addField(`${PREFIX}yazıtura`, 'Yazı tura atar.')
            .addField(`${PREFIX}afk [sebep]`, 'AFK moduna geçer. Belirtilen sebep opsiyoneldir.')
            .addField(`${PREFIX}durum [durum]`, 'Botun durumunu değiştirir. Durumlar: online, idle, dnd, invisible')
            .addField(`${PREFIX}sil [sayı]`, 'Belirtilen kadar mesajı siler. (1-100 arası)')
            .addField(`${PREFIX}tutsayi [min] [max]`, 'Belirtilen aralıkta rastgele bir sayı seçer.')
            .setColor('#00ff00');
        message.channel.send(embed);
    }

    // Botu Yeniden Başlatma Komutu (Sadece bot sahibi)
    if (message.content.startsWith(`${PREFIX}yenidenbaslat`) && message.author.id === 'YOUR_BOT_OWNER_ID') {
        const embed = new Discord.MessageEmbed()
            .setTitle('Bot Yeniden Başlatılıyor...')
            .setColor('#ffff00');
        message.channel.send(embed)
            .then(() => {
                client.destroy();
                client.login('YOUR_BOT_TOKEN');
            })
            .catch(err => console.error(err));
    }

    // Botu Kapatma Komutu (Sadece bot sahibi)
    if (message.content.startsWith(`${PREFIX}kapat`) && message.author.id === 'YOUR_BOT_OWNER_ID') {
        const embed = new Discord.MessageEmbed()
            .setTitle('Bot Kapatılıyor...')
            .setColor('#ff0000');
        message.channel.send(embed)
            .then(() => {
                client.destroy();
            })
            .catch(err => console.error(err));
    }
});

client.login('TOKEN BURAYA GİRİLECEK');

Komut Listesi

Tüm komutları görmek için: .yardım

.yazıtura
Yazı tura atar.

.afk [sebep]
AFK moduna geçer. Belirtilen sebep opsiyoneldir.

.durum [durum]
Botun durumunu değiştirir. Durumlar: "online", "idle", "dnd", "invisible"

.sil [sayı]
Belirtilen kadar mesajı siler. (1-100 arası)

.tutsayi [min] [max]
Belirtilen aralıkta rastgele bir sayı seçer.

.yenidenbaslat
Botu yeniden başlatır (Sadece bot sahibi).

.kapat
Botu kapatır (Sadece bot sahibi).
Hata mesajı, tek başına oldukça az bilgi veriyor. Kodunuzu her daim paylaşmanız yararlı olacaktır.
Buyrun hocam kusra bakmayın.

const Discord = require('discord.js');
const { Client, GatewayIntentBits } = Discord;

// AFK ve AFK mesajı için değişkenler
let afkUsers = {};
let afkMessage = "[I]AFK[/I]: {reason} ({duration} dakika)";

// Bot tokenı (ortam değişkeninden veya güvenli yöntemden yükleyin)
const BOT_TOKEN = process.env.BOT_TOKEN;

// Bot kurulumu
const client = new Client({ intents : [GatewayIntentBits.Guilds] });

// Yazı tura komutu
client.on('message', async message => {
if (message.content === '.yazıtura') {
const coin = ['Yüz', 'Tura'];
const randomCoin = coin[Math.floor(Math.random() * coin.length)];
const embed = new Discord.MessageEmbed()
.setTitle('Yazı Tura')
.setDescription([ICODE]**Kazanan:** ${randomCoin})[/ICODE]
.setColor(randomCoin === 'Yüz' ? '#00ff00' : '#ff0000'); // Renkleri Yüz için yeşil, Tura için kırmızı yapar
message.channel.send({ embeds: [embed] });
}
});

// AFK komutu
client.on('message', async message => {
if (message.content.startsWith('.afk')) {
const reason = message.content.slice(4);
if (!reason) return message.channel.send('Lütfen AFK olma sebebinizi girin.');

afkUsers[message.author.id] = {
reason,
startTime: Date.now()
};

const embed = new Discord.MessageEmbed()
.setTitle('AFK')
.setDescription([ICODE]**Kullanıcı:** ${message.author.username}\n**Sebep:** ${reason})[/ICODE]
.setColor('#ff0000'); // AFK iken kırmızı
message.channel.send({ embeds: [embed] });
}
});

// AFK mesajı ve otomatik AFK çıkışı
client.on('message', async message => {
if (afkUsers[message.author.id]) {
const afkUser = afkUsers[message.author.id];
const afkDuration = Math.floor((Date.now() - afkUser.startTime) / 60000);

if (message.author !== afkUser.id) {
const embed = new Discord.MessageEmbed()
.setTitle('AFK Modundan Çıkış')
.setDescription([ICODE]**Kullanıcı:** ${message.author.username}\n**Sebep:** ${afkUser.reason}\n**Süre:** ${afkDuration} dakika)[/ICODE]
.setColor('#00ff00'); // AFK'dan çıkınca yeşil
message.channel.send({ embeds: [embed] });
delete afkUsers[message.author.id];
message.channel.send([ICODE]AFK modundan çıktınız. (${afkDuration} dakika afk oldunuz));[/ICODE]
}
}
});

// Günaydın ve Merhaba mesajları
client.on('message', async message => {
if (message.content.toLowerCase().includes('güno') || message.content.toLowerCase().includes('guno')) {
const embed = new Discord.MessageEmbed()
.setDescription('Günaydın!')
.setColor('#ffff00'); // Sarı renk
message.channel.send({ embeds: [embed] });
} else if (message.content.toLowerCase().includes('helü') || message.content.toLowerCase().includes('helu')) {
const embed = new Discord.MessageEmbed()
.setDescription('Merhaba!')
.setColor('#ffff00'); // Sarı renk
message.channel.send({ embeds: [embed] });
}
});

// Durum komutu
client.on('message', async message => {
if (message.content.startsWith('.durum')) {
const status = message.content.slice(7).toLowerCase();

if (status === 'idle') {
client.user.setActivity('Boşta', { type: 'PLAYING' });
const embed = new Discord.MessageEmbed()
.setDescription('Durumunuz boşta olarak ayarlandı.')
.setColor('#00ff00'); // Yeşil renk
message.channel.send({ embeds: [embed] });
} else if (status === 'online') {
client.user.setActivity(null);
const embed = new Discord.MessageEmbed()
.setDescription('Durumunuz çevrimiçi olarak ayarlandı.')
.setColor('#00ff00'); // Yeşil renk
message.channel.send({ embeds: [embed] });
} else if (status === 'dnd') {
client.user.setActivity('Rahatsız Etmeyin', { type: 'PLAYING' });
const embed = new Discord.MessageEmbed()
.setDescription('Durumunuz rahatsız etme olarak ayarlandı.')
.setColor('#ff0000'); // Kırmızı renk
message.channel.send({ embeds: [embed] });
} else {
const embed = new Discord.MessageEmbed()
.setDescription('Geçersiz durum. Lütfen idle, online veya dnd girin.')
.setColor('#ff0000'); // Kırmızı renk
message.channel.send({ embeds: [embed] });
}
}
});

// Etkinlik mesajı
client.user.setActivity('Komi-San Can't Communicate İzliyor', { type: 'WATCHING' });

TOKEN GİZLİ
 
Son satırda Can't'teki tırnak, ilk argüman olan Komi-San Can't Communicate İzliyor stringini erkenden kapatıyor. Sanırım hata bundan kaynaklanıyor.

Bunun için Can't'teki tırnağı backslash ile "kurtarmalısınız", şu şekilde:
JavaScript:
client.user.setActivity('Komi-San Can\'t Communicate İzliyor', { type: 'WATCHING' });

Bir de fark etmemişim, backslash'e gerek olmadan argümanı tek tırnaklar yerine çift tırnaklar içine alabilirsiniz tabii, daha hoş olur:
JavaScript:
client.user.setActivity("Komi-San Can't Communicate İzliyor", { type: 'WATCHING' });
 
@brkdnmz yaptım ama bu sefer de şöyle bir çıktı veriyor:

C:\dcbot\Komisan\index.cjs:21
.setDescription([ICODE]**Kazanan:** ${randomCoin})[/ICODE]
^^^^^^^

SyntaxError: missing ) after argument list
at wrapSafe (node:internal/modules/cjs/loader:1281:20)
at Module._compile (node:internal/modules/cjs/loader:1321:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
at Module.load (node:internal/modules/cjs/loader:1208:32)
at Module._load (node:internal/modules/cjs/loader:1024:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:174:12)
at node:internal/main/run_main_module:28:49

Node.js v20.15.0

Kod:
const Discord = require('discord.js');
const { Client, GatewayIntentBits  } = Discord;

// AFK ve AFK mesajı için değişkenler
let afkUsers = {};
let afkMessage = "[I]AFK[/I]: {reason} ({duration} dakika)";

// Bot tokenı (ortam değişkeninden veya güvenli yöntemden yükleyin)
const BOT_TOKEN = process.env.BOT_TOKEN;

// Bot kurulumu
const client = new Client({ intents : [GatewayIntentBits.Guilds] });

// Yazı tura komutu
client.on('message', async message => {
  if (message.content === '.yazıtura') {
    const coin = ['Yüz', 'Tura'];
    const randomCoin = coin[Math.floor(Math.random() * coin.length)];
    const embed = new Discord.MessageEmbed()
      .setTitle('Yazı Tura')
      .setDescription([ICODE]**Kazanan:** ${randomCoin}[/ICODE])
      .setColor(randomCoin === 'Yüz' ? '#00ff00' : '#ff0000'); // Renkleri Yüz için yeşil, Tura için kırmızı yapar
    message.channel.send({ embeds: [embed] });
  }
});

// AFK komutu
client.on('message', async message => {
  if (message.content.startsWith('.afk')) {
    const reason = message.content.slice(4);
    if (!reason) return message.channel.send('Lütfen AFK olma sebebinizi girin.');

    afkUsers[message.author.id] = {
      reason,
      startTime: Date.now()
    };

    const embed = new Discord.MessageEmbed()
      .setTitle('AFK')
      .setDescription([ICODE]**Kullanıcı:** ${message.author.username}\n**Sebep:** ${reason}[/ICODE])
      .setColor('#ff0000'); // AFK iken kırmızı
    message.channel.send({ embeds: [embed] });
  }
});

// AFK mesajı ve otomatik AFK çıkışı
client.on('message', async message => {
  if (afkUsers[message.author.id]) {
    const afkUser = afkUsers[message.author.id];
    const afkDuration = Math.floor((Date.now() - afkUser.startTime) / 60000);

    if (message.author !== afkUser.id) {
      const embed = new Discord.MessageEmbed()
        .setTitle('AFK Modundan Çıkış')
        .setDescription([ICODE]**Kullanıcı:** ${message.author.username}\n**Sebep:** ${afkUser.reason}\n**Süre:** ${afkDuration} dakika[/ICODE])
        .setColor('#00ff00'); // AFK'dan çıkınca yeşil
      message.channel.send({ embeds: [embed] });
      delete afkUsers[message.author.id];
      message.channel.send([ICODE]AFK modundan çıktınız. (${afkDuration} dakika afk oldunuz)[/ICODE]);
    }
  }
});

// Günaydın ve Merhaba mesajları
client.on('message', async message => {
  if (message.content.toLowerCase().includes('güno') || message.content.toLowerCase().includes('guno')) {
    const embed = new Discord.MessageEmbed()
      .setDescription('Günaydın!')
      .setColor('#ffff00'); // Sarı renk
    message.channel.send({ embeds: [embed] });
  } else if (message.content.toLowerCase().includes('helü') || message.content.toLowerCase().includes('helu')) {
    const embed = new Discord.MessageEmbed()
      .setDescription('Merhaba!')
      .setColor('#ffff00'); // Sarı renk
    message.channel.send({ embeds: [embed] });
  }
});

// Durum komutu
client.on('message', async message => {
  if (message.content.startsWith('.durum')) {
    const status = message.content.slice(7).toLowerCase();

    if (status === 'idle') {
      client.user.setActivity('Boşta', { type: 'PLAYING' });
      const embed = new Discord.MessageEmbed()
        .setDescription('Durumunuz boşta olarak ayarlandı.')
        .setColor('#00ff00'); // Yeşil renk
      message.channel.send({ embeds: [embed] });
    } else if (status === 'online') {
      client.user.setActivity(null);
      const embed = new Discord.MessageEmbed()
        .setDescription('Durumunuz çevrimiçi olarak ayarlandı.')
        .setColor('#00ff00'); // Yeşil renk
      message.channel.send({ embeds: [embed] });
    } else if (status === 'dnd') {
      client.user.setActivity('Rahatsız Etmeyin', { type: 'PLAYING' });
      const embed = new Discord.MessageEmbed()
        .setDescription('Durumunuz rahatsız etme olarak ayarlandı.')
        .setColor('#ff0000'); // Kırmızı renk
      message.channel.send({ embeds: [embed] });
    } else {
      const embed = new Discord.MessageEmbed()
        .setDescription('Geçersiz durum. Lütfen idle, online veya dnd girin.')
        .setColor('#ff0000'); // Kırmızı renk
      message.channel.send({ embeds: [embed] });
    }
  }
});

// Etkinlik mesajı
client.user.setActivity('Komi-San Can\'t Communicate İzliyor', { type: 'WATCHING' });

TOKEN GİZLİ
 
Şu [ICODE]'lu satırları düzeltmeniz gerekiyor. Sosyal'deki editör, ters tırnakları (`) satır içi kod olarak algılıyor galiba.

Örnek düzeltme:
Kod:
.setDescription(`**Kazanan:** ${randomCoin}`)
 
Şu [ICODE]'lu satırları düzeltmeniz gerekiyor. Sosyal'deki editör, ters tırnakları (`) satır içi kod olarak algılıyor galiba.

Örnek düzeltme:
Kod:
.setDescription(`**Kazanan:** ${randomCoin}`)
Hocam ben size başka bir bozuk kod atsam olur mu? Gemini'ye atmıştım ultra bozmuş.
 
Yapay zeka ile yazıyorsan discord.js v12 ya da v13'e geç. V14'de çok fazla değişiklik var ve yapay zeka bunlarla tam olarak eğitilmemis sanırım.
Hocam 12.5 geçtim yine anlamadı yanlış yazdı :(

Kod:
const Discord = require('discord.js');
const { Client, Intents } = Discord;

// AFK ve AFK mesajı için değişkenler
let afkUsers = {};
let afkMessage = "*AFK*: {reason} ({duration} dakika)";

// Bot tokenı (ortam değişkeninden veya güvenli yöntemden yükleyin)
const BOT_TOKEN = process.env.BOT_TOKEN;

// Bot kurulumu
const client = new Client({ intents : [GatewayIntentBits.Guilds] });

// Yazı tura komutu
client.on('message', async message => {
  if (message.content === '.yazıtura') {
    const coin = ['Yüz', 'Tura'];
    const randomCoin = coin[Math.floor(Math.random() * coin.length)];
    const embed = new Discord.MessageEmbed()
      .setTitle('Yazı Tura')
      .setDescription(**Kazanan:** ${randomCoin})
      .setColor(randomCoin === 'Yüz' ? '#00ff00' : '#ff0000'); // Renkleri Yüz için yeşil, Tura için kırmızı yapar
    message.channel.send({ embeds: [embed] });
  }
});

// AFK komutu
client.on('message', async message => {
  if (message.content.startsWith('.afk')) {
    const reason = message.content.slice(4);
    if (!reason) return message.channel.send('Lütfen AFK olma sebebinizi girin.');

    afkUsers[message.author.id] = {
      reason,
      startTime: Date.now()
    };

    const embed = new Discord.MessageEmbed()
      .setTitle('AFK')
      .setDescription(**Kullanıcı:** ${message.author.username}\n**Sebep:** ${reason})
      .setColor('#ff0000'); // AFK iken kırmızı
    message.channel.send({ embeds: [embed] });
  }
});

// AFK mesajı ve otomatik AFK çıkışı
client.on('message', async message => {
  if (afkUsers[message.author.id]) {
    const afkUser = afkUsers[message.author.id];
    const afkDuration = Math.floor((Date.now() - afkUser.startTime) / 60000);

    if (message.author !== afkUser.id) {
      const embed = new Discord.MessageEmbed()
        .setTitle('AFK Modundan Çıkış')
        .setDescription(**Kullanıcı:** ${message.author.username}\n**Sebep:** ${afkUser.reason}\n**Süre:** ${afkDuration} dakika)
        .setColor('#00ff00'); // AFK'dan çıkınca yeşil
      message.channel.send({ embeds: [embed] });
      delete afkUsers[message.author.id];
      message.channel.send(AFK modundan çıktınız. (${afkDuration} dakika afk oldunuz));
    }
  }
});

// Günaydın ve Merhaba mesajları
client.on('message', async message => {
  if (message.content.toLowerCase().includes('güno') || message.content.toLowerCase().includes('guno')) {
    const embed = new Discord.MessageEmbed()
      .setDescription('Günaydın!')
      .setColor('#ffff00'); // Sarı renk
    message.channel.send({ embeds: [embed] });
  } else if (message.content.toLowerCase().includes('helü') || message.content.toLowerCase().includes('helu')) {
    const embed = new Discord.MessageEmbed()
      .setDescription('Merhaba!')
      .setColor('#ffff00'); // Sarı renk
    message.channel.send({ embeds: [embed] });
  }
});

// Durum komutu
client.on('message', async message => {
  if (message.content.startsWith('.durum')) {
    const status = message.content.slice(7).toLowerCase();

    if (status === 'idle') {
      client.user.setActivity('Boşta', { type: 'PLAYING' });
      const embed = new Discord.MessageEmbed()
        .setDescription('Durumunuz boşta olarak ayarlandı.')
        .setColor('#00ff00'); // Yeşil renk
      message.channel.send({ embeds: [embed] });
    } else if (status === 'online') {
      client.user.setActivity(null);
      const embed = new Discord.MessageEmbed()
        .setDescription('Durumunuz çevrimiçi olarak ayarlandı.')
        .setColor('#00ff00'); // Yeşil renk
      message.channel.send({ embeds: [embed] });
    } else if (status === 'dnd') {
      client.user.setActivity('Rahatsız Etmeyin', { type: 'PLAYING' });
      const embed = new Discord.MessageEmbed()
        .setDescription('Durumunuz rahatsız etme olarak ayarlandı.')
        .setColor('#ff0000'); // Kırmızı renk
      message.channel.send({ embeds: [embed] });
    } else {
      const embed = new Discord.MessageEmbed()
        .setDescription('Geçersiz durum. Lütfen idle, online veya dnd girin.')
        .setColor('#ff0000'); // Kırmızı renk
      message.channel.send({ embeds: [embed] });
    }
  }
});

// Etkinlik mesajı
client.user.setActivity('Komi-San Can\'t Communicate İzliyor', { type: 'WATCHING' });

// Botun giriş yapması
client.login('sansürbiip');

[CODE title="HATA"] .setDescription(Kazanan: ${randomCoin})
^^

SyntaxError: Unexpected token '**'
at wrapSafe (node:internal/modules/cjs/loader:1281:20)
at Module._compile (node:internal/modules/cjs/loader:1321:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
at Module.load (node:internal/modules/cjs/loader:1208:32)
at Module._load (node:internal/modules/cjs/loader:1024:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:174:12)
at node:internal/main/run_main_module:28:49

Node.js v20.15.0[/CODE]
 
Hocam 12.5 geçtim yine anlamadı yanlış yazdı :(

Kod:
const Discord = require('discord.js');
const { Client, Intents } = Discord;

// AFK ve AFK mesajı için değişkenler
let afkUsers = {};
let afkMessage = "*AFK*: {reason} ({duration} dakika)";

// Bot tokenı (ortam değişkeninden veya güvenli yöntemden yükleyin)
const BOT_TOKEN = process.env.BOT_TOKEN;

// Bot kurulumu
const client = new Client({ intents : [GatewayIntentBits.Guilds] });

// Yazı tura komutu
client.on('message', async message => {
  if (message.content === '.yazıtura') {
    const coin = ['Yüz', 'Tura'];
    const randomCoin = coin[Math.floor(Math.random() * coin.length)];
    const embed = new Discord.MessageEmbed()
      .setTitle('Yazı Tura')
      .setDescription(**Kazanan:** ${randomCoin})
      .setColor(randomCoin === 'Yüz' ? '#00ff00' : '#ff0000'); // Renkleri Yüz için yeşil, Tura için kırmızı yapar
    message.channel.send({ embeds: [embed] });
  }
});

// AFK komutu
client.on('message', async message => {
  if (message.content.startsWith('.afk')) {
    const reason = message.content.slice(4);
    if (!reason) return message.channel.send('Lütfen AFK olma sebebinizi girin.');

    afkUsers[message.author.id] = {
      reason,
      startTime: Date.now()
    };

    const embed = new Discord.MessageEmbed()
      .setTitle('AFK')
      .setDescription(**Kullanıcı:** ${message.author.username}\n**Sebep:** ${reason})
      .setColor('#ff0000'); // AFK iken kırmızı
    message.channel.send({ embeds: [embed] });
  }
});

// AFK mesajı ve otomatik AFK çıkışı
client.on('message', async message => {
  if (afkUsers[message.author.id]) {
    const afkUser = afkUsers[message.author.id];
    const afkDuration = Math.floor((Date.now() - afkUser.startTime) / 60000);

    if (message.author !== afkUser.id) {
      const embed = new Discord.MessageEmbed()
        .setTitle('AFK Modundan Çıkış')
        .setDescription(**Kullanıcı:** ${message.author.username}\n**Sebep:** ${afkUser.reason}\n**Süre:** ${afkDuration} dakika)
        .setColor('#00ff00'); // AFK'dan çıkınca yeşil
      message.channel.send({ embeds: [embed] });
      delete afkUsers[message.author.id];
      message.channel.send(AFK modundan çıktınız. (${afkDuration} dakika afk oldunuz));
    }
  }
});

// Günaydın ve Merhaba mesajları
client.on('message', async message => {
  if (message.content.toLowerCase().includes('güno') || message.content.toLowerCase().includes('guno')) {
    const embed = new Discord.MessageEmbed()
      .setDescription('Günaydın!')
      .setColor('#ffff00'); // Sarı renk
    message.channel.send({ embeds: [embed] });
  } else if (message.content.toLowerCase().includes('helü') || message.content.toLowerCase().includes('helu')) {
    const embed = new Discord.MessageEmbed()
      .setDescription('Merhaba!')
      .setColor('#ffff00'); // Sarı renk
    message.channel.send({ embeds: [embed] });
  }
});

// Durum komutu
client.on('message', async message => {
  if (message.content.startsWith('.durum')) {
    const status = message.content.slice(7).toLowerCase();

    if (status === 'idle') {
      client.user.setActivity('Boşta', { type: 'PLAYING' });
      const embed = new Discord.MessageEmbed()
        .setDescription('Durumunuz boşta olarak ayarlandı.')
        .setColor('#00ff00'); // Yeşil renk
      message.channel.send({ embeds: [embed] });
    } else if (status === 'online') {
      client.user.setActivity(null);
      const embed = new Discord.MessageEmbed()
        .setDescription('Durumunuz çevrimiçi olarak ayarlandı.')
        .setColor('#00ff00'); // Yeşil renk
      message.channel.send({ embeds: [embed] });
    } else if (status === 'dnd') {
      client.user.setActivity('Rahatsız Etmeyin', { type: 'PLAYING' });
      const embed = new Discord.MessageEmbed()
        .setDescription('Durumunuz rahatsız etme olarak ayarlandı.')
        .setColor('#ff0000'); // Kırmızı renk
      message.channel.send({ embeds: [embed] });
    } else {
      const embed = new Discord.MessageEmbed()
        .setDescription('Geçersiz durum. Lütfen idle, online veya dnd girin.')
        .setColor('#ff0000'); // Kırmızı renk
      message.channel.send({ embeds: [embed] });
    }
  }
});

// Etkinlik mesajı
client.user.setActivity('Komi-San Can\'t Communicate İzliyor', { type: 'WATCHING' });

// Botun giriş yapması
client.login('sansürbiip');

[CODE title="HATA"] .setDescription(Kazanan: ${randomCoin})
^^

SyntaxError: Unexpected token '**'
at wrapSafe (node:internal/modules/cjs/loader:1281:20)
at Module._compile (node:internal/modules/cjs/loader:1321:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
at Module.load (node:internal/modules/cjs/loader:1208:32)
at Module._load (node:internal/modules/cjs/loader:1024:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:174:12)
at node:internal/main/run_main_module:28:49

Node.js v20.15.0[/CODE]
GPT-4o dener misiniz bir de hocam.
 
GPT-4o ile yaptım da hocam iyice ağlattı. Dün cilalanmış gibi çalışıyordu bugün içine etti birkaç seçenek ekledim diye.
Hocam direkt tek komutta yapmak yerine dosyalara ayırın. Ben config.json, index.js ve örnek test komutu yazdığım altyapıyı size atayim. Siz de bu altyapıya yazitura.js yazdirtin. jackiste

npm install yazarak yükleyin, npm run dev yazarak çalıştırın nodemon dahil ettim değişiklileri izliyor. config.json dosyasına token gireceksiniz, index.js dosyasi da komutlar klasörün de ki komutları algılamaya yarıyor. Test komudu yazdım !test yazarak deneyebilirsiniz.