dcsv.js
v1.1.1
Published
Ultra High Performance, Stackless Discord Library + Container UI System
Maintainers
Readme
dcsv.js
Ultra High Performance, Stackless Discord Library
dcsv.js is a lightweight, raw-performance focused Discord library designed for massive scale. Unlike other libraries that cache everything (Users, Guilds, Channels) and consume Gigabytes of RAM, dcsv.js is Stackless. It caches nothing by default, giving you 95% memory savings compared to traditional libraries.
🚀 Features
- Stackless Architecture: Zero caching. 100% control.
- Auto-Sharding: Built-in, zero-config sharding. Just set
shards: 'auto'. - Container UI: 💎 Exclusive: Built-in helper for beautiful, professional "Container" style layouts (Ansi-enhanced).
- Memory Efficient: Runs 20,000+ server bots on <500MB RAM.
- Raw Events: Listen to any Discord event directly.
- Interaction Focused: Optimized for Slash Commands and Buttons.
- Connection Pooling: Advanced HTTP keep-alive for lower latency.
📦 Installation
npm install dcsv.js ws⚡ Quick Start
const { Client, GatewayIntentBits } = require('dcsv.js');
const client = new Client({
intents: GatewayIntentBits.Guilds | GatewayIntentBits.GuildMessages,
shards: 'auto' // Automatically spawns required shards
});
client.on('ready', (user) => {
console.log(`Logged in as ${user.username}!`);
console.log(`Ready to serve on ${client.shards.size} shards.`);
// Set Status
client.setPresence({ name: 'dcsv.js Power', type: 0 });
});
client.on('interactionCreate', async (interaction) => {
if (!interaction.isCommand()) return;
if (interaction.data.name === 'ping') {
await interaction.reply({ content: 'Pong! 🏓 (Stackless Speed)' });
}
});
// Access Raw Events directly
client.on('GUILD_MEMBER_ADD', (data) => {
console.log(`User ${data.user.username} joined guild ${data.guild_id}`);
});
client.login('YOUR_BOT_TOKEN');🧠 Philosophy: What is "Stackless"?
Traditional libraries maintain a massive Map of every user, channel, and role your bot sees.
- Bot joins 1,000 servers: Cache size ~200MB.
- Bot joins 20,000 servers: Cache size ~8GB (Crash!).
dcsv.js does not cache.
- When you need a user? You fetch it.
- When you need a channel? You fetch it.
- Most of the time? You just reply to the Event/Interaction, which carries all the data you need!
📚 Documentation
Client Options
new Client({
intents: number, // Required
shards: 'auto' | number, // Default: 1
debug: boolean // Default: false
})Methods
client.login(token)client.request(method, endpoint, body)- Raw API requestclient.createMessage(channelId, content)- Helperclient.getGuild(guildId)- Helper
Events
dcsv.js emits standard Discord event names as per Discord API Docs.
readyinteractionCreatemessageCreateGUILD_CREATEVOICE_STATE_UPDATE- ...and all others!
🍳 Cookbook / Recipes
Since dcsv.js is stackless, you rely on the Discord API for data. Here are common patterns:
1. Fetching User Banner
We don't cache users. To get a banner, fetch the user profile dynamically.
// GET /users/{id}
const user = await client.request('GET', `/users/${userId}`);
if (user.banner) {
const ext = user.banner.startsWith('a_') ? 'gif' : 'png';
const url = `https://cdn.discordapp.com/banners/${user.id}/${user.banner}.${ext}?size=1024`;
console.log(url);
}2. Fetching Server Details
Need member counts? Ask the API.
// GET /guilds/{id}?with_counts=true
const guild = await client.request('GET', `/guilds/${guildId}?with_counts=true`);
console.log(`Server: ${guild.name}`);
console.log(`Members: ${guild.approximate_member_count}`);
console.log(`Online: ${guild.approximate_presence_count}`);3. Sending an Embed
We support standard Discord Embed objects.
await client.createMessage(channelId, {
content: "Here is your info:",
embeds: [{
title: "Hello World",
color: 0x00FF00, // Hex Color
description: "This is a stackless embed.",
fields: [
{ name: "Field 1", value: "Value 1", inline: true }
]
}]
});4. Handling Buttons (Interactions)
client.on('interactionCreate', async (interaction) => {
if (interaction.isButton()) {
if (interaction.customId === 'click_me') {
await interaction.reply({
content: "You clicked the button!",
flags: 64 // Ephemeral (Hidden)
});
}
}
});5. ✨ Exclusive: Create Container Message
Build professional, modern UIs instantly.
await client.createContainer(channelId, {
title: "SERVER STATUS",
color: 0x5865F2, // Blurple
sections: [
{ title: "Performance", content: " [32mStable [0m" },
{ title: "Uptime", content: " [34m99.9% [0m", inline: true }
],
footer: "Powered by dcsv.js"
});🤝 Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
📄 License
🔗 Official Links
| Resource | Link | |----------|------| | Website | dcsv.me | | GitHub | DiscordSunucu/dcsv.js | | NPM | npmjs.com/package/dcsv.js |
📚 Documentation (Backlinks)
Since dcsv.js is designed for high-scale, reading the docs is recommended.
Turkish (TR) 🇹🇷
English (EN) 🇺🇸
