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

disrev.js

v1.2.0

Published

Discord ve Revolt botları için tek client modülü

Readme

disrev.js

Disrev.js, Discord ve Revolt platformlarını tek bir client üzerinden yönetebilen, güçlü ve modüler bir Node.js bot framework'üdür. Ayrıca AOI.js tarzı variable sistemi ve çoklu database desteği sunar.


📦 Kurulum

npm install disrev.js

Node.js ≥18 gereklidir.


🔑 İçe Aktarma

const { database, DisrevClient } = require('disrev.js');
  • DisrevClient: Discord ve Revolt botlarını yönetmek için ana client
  • database: Desteklenen database türlerini yönetmek için factory

⚡ Desteklenen Database Türleri

Disrev.js, farklı veri saklama ihtiyaçları için modüler database desteği sağlar.

| Tip | Açıklama | | -------- | ----------------------------------------------- | | JSON | Dosya tabanlı basit key-value storage | | SQLite | Hafif ve dosya tabanlı ilişkisel veri | | KeyValue | Hızlı, hafif ve RAM tabanlı key-value storage | | MySQL | Büyük ve ilişkisel veritabanı | | MongoDB | NoSQL, esnek veri modeli | | LavaLink | Müzik botları için özel queue ve state yönetimi |


🔹 JSON Database Örneği

const db = new database('json', { filePath: './data.json' });
await db.set('prefix', '!');
const prefix = await db.get('prefix');
console.log(prefix); // !

🔹 SQLite Örneği

const db = new database('sqlite', { filePath: './db.sqlite' });
await db.set('welcome', 'Hello World!');
console.log(await db.get('welcome'));

🔹 MongoDB Örneği

const db = new database('mongodb', { url: 'mongodb://localhost:27017', dbName: 'disrevDB' });
await db.set('guild_123_prefix', '!');

🛠 Variable Sistemi

Variable sistemi ile sunucu, kullanıcı ve global değişkenleri rahatça yönetebilirsiniz.

// Sunucuya özel değişken
await client.variable.set('guild', 'GUILD_ID', 'prefix', '!');
const prefix = await client.variable.get('guild', 'GUILD_ID', 'prefix');

// Kullanıcıya özel değişken
await client.variable.set('user', 'USER_ID', 'coins', 100);
const coins = await client.variable.get('user', 'USER_ID', 'coins');

// Global değişken
await client.variable.set('global', null, 'botStatus', 'online');
const status = await client.variable.get('global', null, 'botStatus');
  • scope: 'guild' | 'user' | 'global'
  • id: guildID veya userID (global için null)
  • key: değişken adı
  • value: değişken değeri

🤖 DisrevClient Kullanımı

const { DisrevClient } = require('disrev.js');
const client = new DisrevClient({ dbType: 'json', dbOptions: { filePath: './db.json' } });

client.on('ready', info => console.log(`${info.platform} is ready!`));

client.on('message', msg => {
    console.log(`[${msg.platform}] ${msg.author.username}: ${msg.content}`);

    // Mesaj yanıtı
    if(msg.content === '!ping') {
        msg.reply(client, 'Pong!');
    }
});

client.login('DISCORD_TOKEN', 'REVOLT_TOKEN');
  • login(discordToken, revoltToken): İki platformu aynı anda başlatır
  • sendMessage(platform, channelID, content): Her iki platformda mesaj gönderebilir

🔄 Discord ↔ Revolt Mesaj Köprüsü

const crossMap = {
    discordToRevolt: 'REVOLT_CHANNEL_ID',
    revoltToDiscord: 'DISCORD_CHANNEL_ID'
};

client.on('message', msg => {
    if(msg.platform === 'discord') {
        client.sendMessage('revolt', crossMap.discordToRevolt, `[Discord] ${msg.author.username}: ${msg.content}`);
    }
    if(msg.platform === 'revolt') {
        client.sendMessage('discord', crossMap.revoltToDiscord, `[Revolt] ${msg.author.username}: ${msg.content}`);
    }
});
  • Sonsuz döngü önlemek için kendi gönderdiğiniz mesajları filtreleyin.

🧩 Database ve Variable Özet

  • Her database adapteri aynı interface’e sahiptir: set(key, value), get(key), delete(key)
  • Variable sistemi tüm database’lerle uyumludur
  • Sunucu, kullanıcı ve global scope desteği mevcuttur

🔗 Özet

Disrev.js ile:

  • Tek bir client üzerinden Discord ve Revolt botları yönetebilirsiniz
  • Database seçimi tamamen kullanıcıya bırakılmıştır
  • variable yönetimi ile gelişmiş state yönetimi
  • Mesaj köprüsü (bridge) ile iki platform birbirini görebilir

📝 Notlar

  • Node.js ≥18 önerilir
  • Discord.js ≥14 ve Revolt.js ≥2 ile uyumludur
  • Database için gerekli npm paketlerini kurmayı unutmayın (sqlite3, mysql2, mongodb vb.)