npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

statsify

v1.0.0

Published

Discord sunucu istatistikleri ve event takibi için kapsamlı TypeScript modülü

Downloads

16

Readme

📊 Statsify

Discord sunucuları için kapsamlı istatistik ve analiz modülü

npm version license downloads

Statsify, Discord sunucularında gerçekleşen tüm aktiviteleri izleyen, analiz eden ve raporlayan güçlü bir TypeScript modülüdür. Ses kanalı aktivitelerinden mesaj istatistiklerine, üye hareketlerinden rol değişikliklerine kadar her şeyi takip eder.

✨ Özellikler

🎯 Kapsamlı İzleme

  • 🔊 Ses Aktiviteleri: Kanal katılım/ayrılma, streaming, kamera kullanımı
  • 💬 Mesaj İstatistikleri: Mesaj sayısı, karakter sayısı, kanal dağılımı, reaction'lar
  • 👥 Üye Aktiviteleri: Katılım/ayrılma, rol değişiklikleri, ban/unban işlemleri
  • 🏰 Sunucu Olayları: Kanal/rol oluşturma, sunucu ayar değişiklikleri
  • 📨 Davet Takibi: Davet oluşturma/silme, kullanım istatistikleri

🗄️ Esnek Depolama

  • MongoDB: Production-ready, ölçeklenebilir database desteği
  • Dosya Sistemi: JSON tabanlı yerel depolama
  • Bellek: Geçici, hızlı erişim için in-memory depolama

📈 Gerçek Zamanlı Analytics

  • Canlı istatistik takibi
  • Detaylı event logging
  • Otomatik kaydetme sistemi
  • Performans optimizasyonları

🚀 Hızlı Başlangıç

Kurulum

npm install statsify

Temel Kullanım

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

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

// Statsify'ı başlat
const stats = new DiscordStats({
  client: client,
  
  // Takip seçenekleri
  trackVoice: true,
  trackMessages: true,
  trackMembers: true,
  trackReactions: true,
  trackRoles: true,
  trackChannels: true,
  
  // Depolama seçenekleri  
  storageType: 'database', // 'file', 'memory', 'database'
  mongoUri: 'mongodb://localhost:27017/statsify',
  
  // Otomatik kaydetme
  autoSave: true,
  saveInterval: 5 // dakika
});

client.once('ready', async () => {
  console.log('Bot hazır!');
  
  // Statsify'ı başlat
  await stats.init();
  console.log('Statsify başlatıldı!');
});

client.login('YOUR_BOT_TOKEN');

📊 API Kullanımı

Ses İstatistikleri

// Tüm kullanıcıların ses istatistikleri
const voiceStats = stats.getVoiceStats(guildId);

// Belirli bir kullanıcının ses istatistikleri  
const userVoiceStats = stats.getVoiceStats(guildId, userId);

// En aktif ses kullanıcıları
const topVoiceUsers = stats.getMostActiveVoiceUsers(guildId, 10);

// Toplam ses süresi
const totalVoiceTime = stats.getTotalVoiceTime(guildId);

Mesaj İstatistikleri

// Tüm mesaj istatistikleri
const messageStats = stats.getMessageStats(guildId);

// Saatlik mesaj dağılımı
const hourlyMessages = stats.getMessagesByHour(guildId);

// En aktif mesaj kullanıcıları
const topMessageUsers = stats.getMostActiveMessageUsers(guildId, 10);

// Ortalama mesaj uzunluğu
const avgLength = stats.getAverageMessageLength(guildId);

Event Listening

// Ses eventleri
stats.on('voiceJoin', (member, channel) => {
  console.log(`${member.user.username} ses kanalına katıldı: ${channel.name}`);
});

stats.on('voiceLeave', (member, channel) => {
  console.log(`${member.user.username} ses kanalından ayrıldı: ${channel.name}`);
});

// Mesaj eventleri
stats.on('messageCreate', (message) => {
  console.log(`Yeni mesaj: ${message.author.username}`);
});

stats.on('messageDelete', (message) => {
  console.log(`Mesaj silindi: ${message.author.username}`);
});

// Üye eventleri
stats.on('memberJoin', (member) => {
  console.log(`Yeni üye: ${member.user.username}`);
});

stats.on('memberBan', (guild, user) => {
  console.log(`Üye banlandı: ${user.username}`);
});

// Guild eventleri
stats.on('roleCreate', (role) => {
  console.log(`Yeni rol oluşturuldu: ${role.name}`);
});

stats.on('channelCreate', (channel) => {
  console.log(`Yeni kanal oluşturuldu: ${channel.name}`);
});

⚙️ Konfigürasyon

Tam Konfigürasyon Örneği

const stats = new DiscordStats({
  client: client,
  
  // Tracking Options
  trackVoice: true,              // Ses aktiviteleri
  trackMessages: true,           // Mesaj aktiviteleri  
  trackInvites: true,           // Davet aktiviteleri
  trackMembers: true,           // Üye aktiviteleri
  trackStreaming: true,         // Streaming aktiviteleri
  trackCamera: true,            // Kamera aktiviteleri
  trackReactions: true,         // Reaction aktiviteleri
  trackRoles: true,             // Rol aktiviteleri
  trackChannels: true,          // Kanal aktiviteleri
  trackPresence: true,          // Durum aktiviteleri
  trackBans: true,              // Ban aktiviteleri
  
  // Storage Options
  storageType: 'database',       // 'file', 'memory', 'database'
  storagePath: './stats-data',   // Dosya depolama yolu
  
  // MongoDB Options
  mongoUri: 'mongodb://localhost:27017/statsify',
  mongoOptions: {
    maxPoolSize: 10,
    serverSelectionTimeoutMS: 5000,
    socketTimeoutMS: 45000
  },
  
  // Auto Save
  autoSave: true,               // Otomatik kaydetme
  saveInterval: 5,              // Kaydetme aralığı (dakika)
  
  // Event Logging
  enableEventLogging: true,     // Event logları
  logRetentionDays: 30         // Log tutma süresi (gün)
});

🗄️ MongoDB Kurulumu

Yerel MongoDB

# MongoDB'yi indir ve kur
# Windows: https://www.mongodb.com/try/download/community
# macOS: brew install mongodb-community
# Ubuntu: sudo apt install mongodb

# MongoDB'yi başlat
mongod --dbpath /path/to/data/directory

MongoDB Atlas (Cloud)

  1. MongoDB Atlas'a kaydol
  2. Yeni cluster oluştur
  3. Database kullanıcısı oluştur
  4. IP adresini whitelist'e ekle
  5. Connection string'i al
const mongoUri = 'mongodb+srv://username:[email protected]/statsify?retryWrites=true&w=majority';

📱 Örnek Bot

Detaylı örnek bot için examples/mongodb-bot.js dosyasına bakın:

node examples/mongodb-bot.js

Bot Komutları

  • !stats info - Genel sunucu istatistikleri
  • !stats voice - Ses kanalı istatistikleri
  • !stats messages - Mesaj istatistikleri
  • !stats top [voice|messages] - En aktif kullanıcılar
  • !stats me - Kişisel istatistikler
  • !stats server - Sunucu analitikleri
  • !stats analytics - Detaylı analizler

🔧 TypeScript Desteği

Statsify tam TypeScript desteği ile gelir:

import { Client, GatewayIntentBits } from 'discord.js';
import { DiscordStats, VoiceStats, MessageStats } from 'statsify';

const stats = new DiscordStats({
  client,
  trackVoice: true,
  trackMessages: true
});

// Tip güvenli API kullanımı
const voiceStats: VoiceStats[] = stats.getVoiceStats(guildId) as VoiceStats[];
const messageStats: MessageStats[] = stats.getMessageStats(guildId) as MessageStats[];

🔒 Güvenlik

  • ✅ Bot token'larını environment variable'larda saklayın
  • ✅ MongoDB connection string'lerini güvenli tutun
  • ✅ Üretim ortamında uygun firewall kuralları kullanın
  • ✅ MongoDB kullanıcı yetkilendirmesi yapın

🚀 Performans

  • Bulk Operations: MongoDB için optimize edilmiş toplu işlemler
  • Memory Caching: Sık kullanılan veriler için akıllı önbellekleme
  • Event Filtering: Gereksiz eventleri filtreleme
  • Lazy Loading: İhtiyaç halinde veri yükleme

🤝 Katkıda Bulunma

  1. Fork'layın
  2. Feature branch oluşturun (git checkout -b feature/amazing-feature)
  3. Commit'leyin (git commit -m 'Add amazing feature')
  4. Push'layın (git push origin feature/amazing-feature)
  5. Pull Request açın

📄 Lisans

Bu proje MIT lisansı altında yayınlanmıştır. Detaylar için LICENSE dosyasına bakın.

👨‍💻 Geliştirici

MODLOFF - GitHub

📞 Destek

  • 🐛 Bug raporları için Issues açın
  • 💡 Feature istekleri için Discussions kullanın
  • 📚 Daha fazla dökümantasyon için Wiki bölümüne bakın

Statsify ile Discord sunucunuzun her anını takip edin! 📊✨