vaparklink
v1.0.1
Published
Auto Lavalink Connection for Discord Bots - Auto-connect to free Lavalink nodes worldwide
Maintainers
Readme
🎵 VaparkLink - Auto Lavalink Connection
✨ Features
- Auto Lavalink Discovery - ดึง Lavalink free servers จากทั่วโลกอัตโนมัติ
- Health Check System - ตรวจสอบสถานะ nodes อยู่ตลอดเวลา
- Auto Reconnect - เชื่อมต่อใหม่อัตโนมัติเมื่อ node offline
- Multi-Region - มี servers ใน Thailand, Europe, Asia, Americas
- Smart Node Selection - เลือก nodes ที่ response time ดีที่สุด
- Easy Integration - ใช้งานได้กับ Riffy, Discord.js
📦 Installation
npm install vaparklink🚀 Quick Start
Basic Usage
const { Client, GatewayIntentBits } = require('discord.js');
const { createVaparkLink } = require('vaparklink');
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildVoiceStates,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent
]
});
// Initialize VaparkLink - ไม่ต้องตั้งค่า Lavalink เอง!
async function main() {
const vapark = await createVaparkLink(client, {
maxNodes: 6, // จำนวน nodes สูงสุดที่จะใช้
defaultSearchPlatform: 'ytsearch', // แพลตฟอร์มค้นหาเริ่มต้น
autoReconnect: true, // เชื่อมต่อใหม่อัตโนมัติ
});
// ใช้งาน Riffy
const riffy = vapark.getRiffy();
// สร้าง connection
const player = riffy.createConnection({
guildId: interaction.guild.id,
voiceChannelId: interaction.member.voice.channel.id,
textChannelId: interaction.channel.id,
selfDeaf: true
});
// ค้นหาเพลง
const result = await riffy.resolve({ query: 'Never Gonna Give You Up' });
const track = result.tracks[0];
player.play({ track });
}
client.once('ready', () => {
console.log(`Bot ready as ${client.user.tag}`);
main().catch(console.error);
});
client.on('raw', (d) => {
const riffy = vapark.getRiffy();
if (riffy && ['VOICE_STATE_UPDATE', 'VOICE_SERVER_UPDATE'].includes(d.t)) {
riffy.updateVoiceState(d);
}
});
client.login('YOUR_BOT_TOKEN');TypeScript Usage
import { Client, GatewayIntentBits } from 'discord.js';
import { createVaparkLink, VaparkLink } from 'vaparklink';
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildVoiceStates,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent
]
});
let vapark: VaparkLink | null = null;
client.once('ready', async () => {
vapark = await createVaparkLink(client, {
maxNodes: 6,
defaultSearchPlatform: 'ytsearch',
autoReconnect: true,
healthCheckInterval: 60000,
requestTimeout: 5000
});
});📖 API Reference
createVaparkLink(client, options?)
สร้าง VaparkLink instance และ initialize อัตโนมัติ
| Parameter | Type | Description |
|-----------|------|-------------|
| client | Client | Discord.js Client instance |
| options.maxNodes | number | จำนวน nodes สูงสุด (default: 8) |
| options.defaultSearchPlatform | string | แพลตฟอร์มค้นหา (default: 'ytsearch') |
| options.autoReconnect | boolean | เชื่อมต่อใหม่อัตโนมัติ (default: true) |
| options.healthCheckInterval | number | Interval ตรวจสอบ health (ms) (default: 60000) |
| options.reconnectInterval | number | Interval พยายาม reconnect (ms) (default: 30000) |
| options.requestTimeout | number | Timeout สำหรับ health check (ms) (default: 5000) |
VaparkLink Instance Methods
| Method | Return | Description |
|--------|--------|-------------|
| .initialize() | Promise<Riffy> | Initialize VaparkLink |
| .getRiffy() | Riffy \| null | ดึง Riffy instance |
| .getStatus() | VaparkLinkStatus | ดึงสถานะของ VaparkLink |
| .hasConnectedNodes() | boolean | ตรวจสอบว่ามี node เชื่อมต่ออยู่ |
| .getConnectedNodeCount() | number | ดึงจำนวน nodes ที่เชื่อมต่อ |
| .waitForConnection(timeout?) | Promise<boolean> | รอจนกว่าจะมี node เชื่อมต่อ |
| .destroy() | void | ปิดการทำงาน |
Helper Functions
const { getGlobalNodePool, getNodes, getTotalPoolSize } = require('vaparklink');
// ดึง nodes ทั้งหมดใน pool
const allNodes = getGlobalNodePool();
// ดึง nodes จำนวน 5 nodes
const nodes = getNodes(5);
// ดึงจำนวน nodes ทั้งหมด
const total = getTotalPoolSize();🌍 Global Node Pool
VaparkLink รวม Lavalink free servers จากทั่วโลก:
| Region | Nodes | |--------|-------| | 🇹🇭 Thailand | 3 | | 🇪🇺 Europe | 5 | | 🌏 Asia | 4 | | 🇺🇸 Americas | 2 | | 🌐 Global | 2 |
Total: 16+ free Lavalink nodes
📋 Requirements
- Node.js 16+
- discord.js 14+
- riffy 1.x
📝 License
MIT License - Copyright (c) 2026 Kritsdika (FlashX)
🙏 Credits
- Developed by: Kritsdika, CEO of FlashX
- Lavalink Pool: Community free Lavalink servers worldwide
- Powered by: Riffy
💡 Note: Lavalink free servers อาจมีการเปลี่ยนแปลงหรือ offline ได้ตลอดเวลา VaparkLink จะตรวจสอบและจัดการ nodes อัตโนมัติเพื่อให้ใช้งานได้เสมอ
