Kodlar
Discord Sunucu İstatistik Botu.js
Discord Sunucu İstatistik Botu.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
const { Client, GatewayIntentBits } = require('discord.js');

const client = new Client({
    intents: [
        GatewayIntentBits.Guilds,
        GatewayIntentBits.GuildMembers,
        GatewayIntentBits.GuildPresences 
    ]
});

// Ayarlar
const SERVER_ID = 'SUNUCU_ID_BURAYA';
const CHANNEL_ID = 'İSTATİSTİK_KANAL_ID_BURAYA';

client.on('ready', () => {
    console.log(`${client.user.tag} aktif!`);

    const guild = client.guilds.cache.get(SERVER_ID);
    if (!guild) return;

    setInterval(async () => {
        try {
            const totalMembers = guild.memberCount;
            const totalChannels = guild.channels.cache.size;
            const activeMembers = guild.members.cache.filter(m => m.presence?.status && m.presence.status !== 'offline').size;

            const statsChannel = client.channels.cache.get(CHANNEL_ID);
            
            if (statsChannel) {
                await statsChannel.setName(`Üye: ${totalMembers} | Kanal: ${totalChannels} | Aktif: ${activeMembers}`);
            }

        } catch (error) {
            console.error("Hata:", error);
        }
    }, 600000); 
});

client.login('TOKEN_BURAYA');
0Beğeni
85Görüntülenme
Kod Bilgisi
DilJavaScript
Satır39
Karakter1,189
Tarih01.05.2026
Açıklama

Sunucu üye, kanal ve aktif kullanıcı verilerini tek bir kanal adında birleştiren canlı istatistik kodu

Etiketler
#discord