### Manual BotVPN Setup and Installation
Source: https://context7.com/arivpnstores/botvpn/llms.txt
This sequence of commands manually sets up BotVPN by cloning the repository, navigating into the directory, and installing necessary Node.js dependencies using npm. It's a prerequisite for initial setup or development.
```bash
git clone https://github.com/arivpnstores/BotVPN.git
cd BotVPN
npm install
```
--------------------------------
### Automated Installation Script (Bash)
Source: https://context7.com/arivpnstores/botvpn/llms.txt
An automated installation script designed for Ubuntu/Debian systems. It disables IPv6, updates package lists, installs necessary packages (git, curl), downloads the installation script from a GitHub repository, and executes it with the 'sellvpn' argument. The script also handles cleanup by removing the downloaded installation file. Error checking is included to ensure the installation proceeds correctly.
```bash
# Automatic installation
sysctl -w net.ipv6.conf.all.disable_ipv6=1 && \
sysctl -w net.ipv6.conf.default.disable_ipv6=1 && \
apt update -y && apt install -y git curl && \
curl -L -k -sS https://raw.githubusercontent.com/arivpnstores/BotVPN/main/start -o start && \
bash start sellvpn && \
[ $? -eq 0 ] && rm -f start
```
--------------------------------
### Setup SQLite Database Tables in JavaScript
Source: https://context7.com/arivpnstores/botvpn/llms.txt
Initializes and creates the necessary SQLite3 tables for the BotVPN. This includes tables for user data, transaction logs, server configurations, and pending deposits. It uses the 'sqlite3' npm package. Ensure the database file './sellvpn.db' is writable by the application.
```javascript
const sqlite3 = require('sqlite3').verbose();
const db = new sqlite3.Database('./sellvpn.db');
// Users table - stores user balance and registration
db.run(`CREATE TABLE IF NOT EXISTS users (
id INTEGER PRIMARY KEY AUTOINCREMENT,
user_id INTEGER UNIQUE,
saldo INTEGER DEFAULT 0,
CONSTRAINT unique_user_id UNIQUE (user_id)
)`);
// Transactions table - tracks all account operations
db.run(`CREATE TABLE IF NOT EXISTS transactions (
id INTEGER PRIMARY KEY AUTOINCREMENT,
user_id INTEGER,
amount INTEGER,
type TEXT,
reference_id TEXT,
timestamp INTEGER,
FOREIGN KEY (user_id) REFERENCES users(user_id)
)`);
// Server table - stores VPS server configurations
db.run(`CREATE TABLE IF NOT EXISTS Server (
id INTEGER PRIMARY KEY AUTOINCREMENT,
domain TEXT,
auth TEXT,
harga INTEGER,
nama_server TEXT,
quota INTEGER,
iplimit INTEGER,
batas_create_akun INTEGER,
total_create_akun INTEGER
)`);
// Pending deposits - tracks QRIS payment verification
db.run(`CREATE TABLE IF NOT EXISTS pending_deposits (
unique_code TEXT PRIMARY KEY,
user_id INTEGER,
amount INTEGER,
original_amount INTEGER,
timestamp INTEGER,
status TEXT,
qr_message_id INTEGER
)`);
// Query user balance
db.get('SELECT saldo FROM users WHERE user_id = ?', [userId], (err, row) => {
if (row) {
console.log(`Balance: Rp ${row.saldo}`);
}
});
// Record transaction
const timestamp = Date.now();
const referenceId = `ssh-${userId}-${timestamp}`;
db.run('INSERT INTO transactions (user_id, amount, type, reference_id, timestamp) VALUES (?, ?, ?, ?, ?)',
[userId, -15000, 'ssh', referenceId, timestamp]
);
```
--------------------------------
### Start and Save BotVPN with PM2
Source: https://context7.com/arivpnstores/botvpn/llms.txt
This sequence uses PM2, a production process manager for Node.js, to start the BotVPN application, save its current process list, and set up PM2 to start on system boot. This ensures the bot runs reliably in a production environment.
```bash
pm2 start ecosystem.config.js
pm2 save
pm2 startup
```
--------------------------------
### Update BotVPN Installation
Source: https://context7.com/arivpnstores/botvpn/llms.txt
This script updates the BotVPN installation by downloading the latest update script, making it executable, and running it. It's a straightforward way to keep the bot up-to-date.
```bash
curl -sSL https://raw.githubusercontent.com/arivpnstores/BotVPN/main/update.sh -o update.sh && \
chmod +x update.sh && \
bash update.sh
```
--------------------------------
### Environment Configuration (JSON)
Source: https://context7.com/arivpnstores/botvpn/llms.txt
Defines the environment variables for the BotVPN project, loaded from a `.vars.json` file. It includes sensitive information like BOT_TOKEN, API keys, and user IDs, as well as configuration parameters such as PORT, NAMA_STORE, and DATA_QRIS.
```json
{
"BOT_TOKEN": "1234567890:ABCdefGHIjklMNOpqrsTUVwxyz",
"PORT": 6969,
"USER_ID": [123456789, 987654321],
"NAMA_STORE": "@YOUR_STORE",
"DATA_QRIS": "00020101021226670016COM.NOBUBANK.WWW01189360050300000898740214545996600301620303UME51440014ID.CO.QRIS.WWW0215ID20232024738230303UME5204481253033605802ID5912MERCHANT NAME6015JAKARTA SELATAN61051234062070703A0163043D7A",
"MERCHANT_ID": "898740214545996600301",
"API_KEY": "your_api_key_here",
"GROUP_ID": "-1001234567890"
}
```
--------------------------------
### BotVPN Configuration File Creation
Source: https://context7.com/arivpnstores/botvpn/llms.txt
This command creates a `.vars.json` file, essential for configuring BotVPN. It requires users to input sensitive information like API tokens, user IDs, and merchant details. Ensure these values are kept secure.
```bash
cat > .vars.json << EOF
{
"BOT_TOKEN": "YOUR_BOT_TOKEN",
"PORT": 6969,
"USER_ID": [YOUR_ADMIN_ID],
"NAMA_STORE": "@YOUR_STORE",
"DATA_QRIS": "YOUR_QRIS_DATA",
"MERCHANT_ID": "YOUR_MERCHANT_ID",
"API_KEY": "YOUR_API_KEY",
"GROUP_ID": "YOUR_GROUP_ID"
}
EOF
```
--------------------------------
### Telegram Bot Command Handlers with JavaScript
Source: https://context7.com/arivpnstores/botvpn/llms.txt
Handles user interactions in a Telegram bot using the Telegraf library. It includes command handlers for '/start', '/menu', and '/admin', with user registration and admin authorization logic. Requires a BOT_TOKEN and database connection.
```javascript
const { Telegraf } = require('telegraf');
const bot = new Telegraf(BOT_TOKEN);
// Start command - registers user and shows main menu
bot.command(['start', 'menu'], async (ctx) => {
const userId = ctx.from.id;
// Auto-register user in database if not exists
db.get('SELECT * FROM users WHERE user_id = ?', [userId], (err, row) => {
if (!row) {
db.run('INSERT INTO users (user_id) VALUES (?)', [userId]);
}
});
await sendMainMenu(ctx);
});
// Admin command - restricted to authorized users
bot.command('admin', async (ctx) => {
if (!adminIds.includes(ctx.from.id)) {
await ctx.reply('๐ซ Anda tidak memiliki izin untuk mengakses menu admin.');
return;
}
await sendAdminMenu(ctx);
});
// Launch bot
bot.launch();
console.log('Bot started successfully');
```
--------------------------------
### Generate Bot VPN Main Menu (JavaScript)
Source: https://context7.com/arivpnstores/botvpn/llms.txt
Generates an interactive main menu for the Bot VPN, displaying user balance, statistics, and action buttons. It fetches user data from a database and constructs a Telegram message with inline keyboard markup. Dependencies include a database connection (e.g., `db`) and Telegram bot context (`ctx`).
```javascript
async function sendMainMenu(ctx) {
const userId = ctx.from.id;
const userName = ctx.from.first_name || '-';
// Fetch user balance
const row = await new Promise((resolve, reject) => {
db.get('SELECT saldo FROM users WHERE user_id = ?', [userId],
(err, row) => err ? reject(err) : resolve(row)
);
});
const saldo = row ? row.saldo : 0;
// Calculate statistics
const todayStart = new Date().setHours(0,0,0,0);
const userToday = await new Promise((resolve) => {
db.get('SELECT COUNT(*) as count FROM transactions WHERE user_id = ? AND timestamp >= ?',
[userId, todayStart], (err, row) => resolve(row?.count || 0)
);
});
const messageText = `
โญโ โก BOT VPN @ARI_VPN_STORE โก
โ Bot VPN Premium dengan sistem otomatis
โ Akses internet cepat & aman dengan server terpercaya!
๐ Hai, Member ${userName}!
ID: ${userId}
Saldo: Rp ${saldo}
๐ Statistik Anda โข Hari Ini : ${userToday} akunโ๏ธ COMMAND โข ๐ Menu Utama : /start โข ๐ Menu Admin : /admin`; const keyboard = [ [ { text: 'โ Buat Akun', callback_data: 'service_create' }, { text: 'โป๏ธ Perpanjang Akun', callback_data: 'service_renew' } ], [ { text: 'โ Hapus Akun', callback_data: 'service_del' }, { text: '๐ถ Cek Server', callback_data: 'cek_service' } ], [ { text: 'โ Trial Akun', callback_data: 'service_trial' }, { text: '๐ฐ TopUp Saldo', callback_data: 'topup_saldo' } ], ]; await ctx.reply(messageText, { parse_mode: 'HTML', reply_markup: { inline_keyboard: keyboard } }); } ``` -------------------------------- ### User Balance Top-Up Flow (JavaScript) Source: https://context7.com/arivpnstores/botvpn/llms.txt Handles the user balance top-up process, including generating unique payment codes and managing user interactions. It defines functions to generate codes, prompts users for top-up amounts, validates input, stores pending deposits in a database, and sends a QRIS payment code to the user. Dependencies include a 'bot' object for Telegram interactions and a 'userState' object for managing user input flow. ```javascript // Generate unique payment code const generateUniqueCode = (amount) => { const random = Math.floor(Math.random() * 100); return amount + random; }; // Top-up handler bot.action('topup_saldo', async (ctx) => { userState[ctx.from.id] = { state: 'awaiting_topup_amount' }; await ctx.reply('๐ฐ Masukkan jumlah saldo yang ingin Anda top up (minimal Rp 10,000):'); }); // Handle amount input bot.on('text', async (ctx) => { const userId = ctx.from.id; const state = userState[userId]; if (state?.state === 'awaiting_topup_amount') { const amount = parseInt(ctx.message.text); if (amount < 10000) { return ctx.reply('โ Minimal top up Rp 10,000'); } // Generate unique code const uniqueAmount = generateUniqueCode(amount); const uniqueCode = `TOPUP-${userId}-${Date.now()}`; // Store pending deposit db.run( 'INSERT INTO pending_deposits (unique_code, user_id, amount, original_amount, timestamp, status) VALUES (?, ?, ?, ?, ?, ?)', [uniqueCode, userId, uniqueAmount, amount, Date.now(), 'pending'] ); // Send QRIS code await ctx.replyWithPhoto({ source: './qris.png' }, { caption: ` ๐ณ *Informasi Pembayaran QRIS* ๐ Total Transfer: *Rp ${uniqueAmount}* ๐ฐ Jumlah Top Up: *Rp ${amount}* ๐ข Kode Unik: *${uniqueAmount - amount}* โ ๏ธ *PENTING:* - Transfer dengan nominal *PERSIS* Rp ${uniqueAmount} - Pembayaran akan diverifikasi otomatis dalam 1-2 menit - Saldo akan ditambahkan setelah pembayaran terdeteksi Scan QRIS di atas untuk melakukan pembayaran.`, parse_mode: 'Markdown' }); delete userState[userId]; } }); ``` -------------------------------- ### Create Trial SSH Account with JavaScript Source: https://context7.com/arivpnstores/botvpn/llms.txt Creates temporary trial SSH accounts with a fixed 3-hour expiration. This function requires a username, password, and other parameters. It utilizes 'trial' modules and integrates with daily trial access tracking. ```javascript const { trialssh, trialvmess } = require('./modules/trial'); // Create SSH trial account (3 hours) const result = await trialssh('trial_user', 'temp_pass', 1, 1, 1); // Daily trial tracking const { checkTrialAccess, saveTrialAccess } = require('./app'); const userId = 123456789; const hasUsedTrial = await checkTrialAccess(userId); if (!hasUsedTrial) { const account = await trialssh('trial_' + userId, 'pass', 1, 1, 1); await saveTrialAccess(userId); // Send account details } else { // User already used trial today } ``` -------------------------------- ### Create VMess Account - JavaScript Source: https://context7.com/arivpnstores/botvpn/llms.txt Creates a VMess protocol account. This function requires username, expiry days, quota in GB, IP limit (0 for unlimited), and server ID. It returns account details including username, host, UUID, expiry, quota, IP limit, ports, paths, and VMess connection links. ```javascript const { createvmess } = require('./modules/create'); // Create VMess account with 30 days, 50GB quota, unlimited IP const result = await createvmess('user456', 30, 50, 0, 1); // Expected result: // โ *VMess Account Created Successfully!* // // ๐ *Akun VMess Premium* // โโโโโโโโโโโโโโ // ๐ค *Username* : `user456` // ๐ *Host* : `example.com` // ๐ก *UUID* : `a1b2c3d4-e5f6-7890-abcd-ef1234567890` // ๐งพ *Expired* : `2025-11-16` (23:59:59) // ๐ฆ *Quota* : `50 GB` // ๐ข *IP Limit* : `Unlimited IP` // โโโโโโโโโโโโโโ // ๐ก *Ports*: // - TLS : 443 // - Non TLS : 80 // - Any Port : 1-65535 // โโโโโโโโโโโโโโ // ๐ถ *Path*: // - WS : /vmess | /vless-vmess // - gRPC : vmess-grpc // - Upgrade : /upgrade // โโโโโโโโโโโโโโ // ๐ *VMess Links*: // - TLS : `vmess://eyJhZGQiOiJleGFtcGxlLmNvbSIsImFpZCI6IjAi...` ``` -------------------------------- ### Server Information API Source: https://context7.com/arivpnstores/botvpn/llms.txt Retrieves a list of available VPN servers, including their details like name, domain, price, and account creation limits. ```APIDOC ## GET /api/servers ### Description Fetches a list of all configured VPN servers. This endpoint is useful for displaying available servers and their specifications to users or for administrative purposes. ### Method GET ### Endpoint /api/servers ### Parameters None ### Request Example None ### Response #### Success Response (200) - **servers** (array) - An array of server objects. - **id** (integer) - Unique identifier for the server. - **nama_server** (string) - The name of the server. - **domain** (string) - The domain or IP address of the server. - **harga** (number) - The price of the VPN service from this server. - **total_create_akun** (integer) - The total number of accounts that can be created on this server. - **batas_create_akun** (integer) - The limit for creating accounts on this server. #### Response Example ```json { "servers": [ { "id": 1, "nama_server": "sg-server-01", "domain": "192.168.1.10", "harga": 5.00, "total_create_akun": 100, "batas_create_akun": 10 }, { "id": 2, "nama_server": "us-server-01", "domain": "10.0.0.5", "harga": 7.50, "total_create_akun": 150, "batas_create_akun": 15 } ] } ``` #### Error Response (500) - **error** (string) - A message describing the internal server error. #### Error Response Example ```json { "error": "Failed to retrieve server list." } ``` ``` -------------------------------- ### Create Trojan Account - JavaScript Source: https://context7.com/arivpnstores/botvpn/llms.txt Creates a Trojan protocol account with key-based authentication and multiple transport options. Inputs include username, expiry days, quota, IP limit, and server ID. The output details include username, hostname, Trojan key (UUID), expiry, quota, IP limit, TLS port, and connection links for various protocols. ```javascript const { createtrojan } = require('./modules/create'); // Create Trojan account with 30 days, 100GB quota, 5 IP limit const result = await createtrojan('trojanuser', 30, 100, 5, 1); // Expected result includes: // - Username and hostname // - Trojan key (UUID) // - Expiry date: 2025-11-16 (23:59:59) // - Quota: 100 GB // - IP Limit: 5 IP // - TLS port: 443 // - Trojan connection links for TLS, gRPC, and upgrade protocols // - Network types: ws, grpc, upgrade ``` -------------------------------- ### Create VLESS Account - JavaScript Source: https://context7.com/arivpnstores/botvpn/llms.txt Creates a VLESS protocol account using UUID-based authentication. It supports WebSocket, gRPC, and HTTP upgrade transports. The function requires username, expiry days, quota (0 for unlimited), IP limit, and server ID. Output includes connection details and supported protocols. ```javascript const { createvless } = require('./modules/create'); // Create VLESS account with 60 days, unlimited quota, 3 IP limit const result = await createvless('vlessuser', 60, 0, 3, 1); // Returns formatted message with: // - Username and hostname // - UUID for authentication // - Expiry date and time // - Quota and IP limit settings // - TLS/Non-TLS/gRPC ports (443, 80, any) // - Connection links for different protocols // - WebSocket paths: /vless, /vless-vmess // - gRPC service name: vless-grpc ``` -------------------------------- ### Create SSH Account - JavaScript Source: https://context7.com/arivpnstores/botvpn/llms.txt Creates a premium SSH/VPN account on a specified server. This function takes username, password, expiry days, IP limit, and server ID as input. It returns formatted account details including connection strings for WebSocket, SSL, UDP, and DNS, along with expiry date, time, IP limit, and ports. ```javascript const { createssh } = require('./modules/create'); // Create SSH account with 30 days expiry and 2 IP limit const result = await createssh('john123', 'SecurePass456', 30, 2, 1); // Expected result: // โ *SSH Account Created Successfully!* // // *๐ SSH Premium Details* // โโโโโโโโโโโโโโโโโโโโโโโโ // ๐ก *SSH WS* : `example.com:80@john123:SecurePass456` // ๐ *SSH SSL* : `example.com:443@john123:SecurePass456` // ๐ถ *SSH UDP* : `example.com:1-65535@john123:SecurePass456` // ๐ *DNS SELOW* : `example.com:5300@john123:SecurePass456` // โโโโโโโโโโโโโโโโโโโโโโโโ // ๐ *Hostname* : `example.com` // ๐ค *Username* : `john123` // ๐ *Password* : `SecurePass456` // ๐ *Expiry Date* : `2025-11-16` // โฐ *Expiry Time* : `23:59:59` // ๐ *IP Limit* : `2` // โโโโโโโโโโโโโโโโโโโโโโโโ // ๐ *Ports*: // โข TLS : `443` // โข Non-TLS : `80` // โข OVPN TCP : `1194` // โข OVPN UDP : `2200` // โข SSH OHP : `8080` // โข UDP Custom : `1-65535` // โโโโโโโโโโโโโโโโโโโโโโโโ // ๐งฉ *Payload WS*: // ` // GET / HTTP/1.1 // Host: example.com // Connection: Upgrade // User-Agent: [ua] // Upgrade: websocket // ` ``` -------------------------------- ### Manage Server Configurations in JavaScript Source: https://context7.com/arivpnstores/botvpn/llms.txt Provides functions for administrative operations on the 'Server' table in the SQLite database. This includes adding new server entries, updating existing server details like domain and price, and retrieving server information. It returns Promises for asynchronous operations. ```javascript // Add new server const addServer = (domain, auth, harga, nama, quota, iplimit, batas) => { return new Promise((resolve, reject) => { db.run( 'INSERT INTO Server (domain, auth, harga, nama_server, quota, iplimit, batas_create_akun, total_create_akun) VALUES (?, ?, ?, ?, ?, ?, ?, 0)', [domain, auth, harga, nama, quota, iplimit, batas], (err) => err ? reject(err) : resolve() ); }); }; // Usage: /addserver domain.com authtoken 15000 "Server SG" 50 2 100 // Update server configuration const updateServerDomain = (serverId, newDomain) => { db.run('UPDATE Server SET domain = ? WHERE id = ?', [newDomain, serverId]); }; const updateServerAuth = (serverId, newAuth) => { db.run('UPDATE Server SET auth = ? WHERE id = ?', [newAuth, serverId]); }; const updateServerPrice = (serverId, newPrice) => { db.run('UPDATE Server SET harga = ? WHERE id = ?', [newPrice, serverId]); }; // Get server details db.get('SELECT * FROM Server WHERE id = ?', [serverId], (err, server) => { if (server) { console.log(`Server: ${server.nama_server}`); console.log(`Domain: ${server.domain}`); console.log(`Price: Rp ${server.harga}`); console.log(`Quota: ${server.quota}GB`); console.log(`IP Limit: ${server.iplimit}`); console.log(`Created: ${server.total_create_akun}/${server.batas_create_akun}`); } }); ``` -------------------------------- ### Admin Commands for Bot VPN Management (JavaScript) Source: https://context7.com/arivpnstores/botvpn/llms.txt Provides administrative functions for the Bot VPN, including adding balance to user accounts, broadcasting messages to all users, and deleting bot logs. These commands require administrator privileges. Dependencies include a database connection (`db`), `axios` for API requests, `fs` for file operations, and a list of admin IDs (`adminIds`). ```javascript // Add balance to user account bot.command('addsaldo', async (ctx) => { if (!adminIds.includes(ctx.from.id)) return ctx.reply('Tidak ada izin!'); // Usage: /addsaldo 123456789 50000 const args = ctx.message.text.split(' '); const targetUserId = parseInt(args[1]); const amount = parseInt(args[2]); db.run('UPDATE users SET saldo = saldo + ? WHERE user_id = ?', [amount, targetUserId], (err) => { if (err) { ctx.reply('โ Gagal menambah saldo'); } else { ctx.reply(`โ Berhasil menambah saldo Rp ${amount} ke user ${targetUserId}`); } } ); }); // Broadcast message to all users bot.command('broadcast', async (ctx) => { if (!adminIds.includes(ctx.from.id)) { return ctx.reply('โ ๏ธ Anda tidak memiliki izin untuk menggunakan perintah ini.'); } const message = ctx.message.text.split(' ').slice(1).join(' '); if (!message) { return ctx.reply('โ ๏ธ Mohon berikan pesan untuk disiarkan.'); } db.all("SELECT user_id FROM users", [], (err, rows) => { if (err) { return ctx.reply('โ ๏ธ Kesalahan saat mengambil daftar pengguna.'); } rows.forEach((row) => { axios.post(`https://api.telegram.org/bot${BOT_TOKEN}/sendMessage`, { chat_id: row.user_id, text: message }).catch(error => { console.error(`Failed to send to ${row.user_id}:`, error.message); }); }); ctx.reply('โ Pesan siaran berhasil dikirim.'); }); }); // Delete bot logs bot.command('hapuslog', async (ctx) => { if (!adminIds.includes(ctx.from.id)) return ctx.reply('Tidak ada izin!'); try { if (fs.existsSync('bot-combined.log')) fs.unlinkSync('bot-combined.log'); if (fs.existsSync('bot-error.log')) fs.unlinkSync('bot-error.log'); ctx.reply('โ Log berhasil dihapus.'); } catch (e) { ctx.reply('โ Gagal menghapus log: ' + e.message); } }); ``` -------------------------------- ### QRIS Payment Verification with Orkut API (JavaScript) Source: https://context7.com/arivpnstores/botvpn/llms.txt Integrates with the Orkut API to verify QRIS payment transactions. It defines API endpoints, request headers, and payload construction. The script checks for incoming payments, matches them with pending deposits in a database, credits user accounts, and updates deposit statuses. It runs the payment check function every 30 seconds. Dependencies include 'axios' for HTTP requests and a local module './api-cekpayment-orkut' for API configuration. ```javascript const { buildPayload, headers, API_URL } = require('./api-cekpayment-orkut'); const axios = require('axios'); // Configure payment API credentials // File: api-cekpayment-orkut.js const qs = require('qs'); function buildPayload() { return qs.stringify({ 'username': 'your_username', 'token': 'your_token:id:signature', 'jenis': 'masuk' }); } const headers = { 'Content-Type': 'application/x-www-form-urlencoded', 'Accept-Encoding': 'gzip', 'User-Agent': 'okhttp/4.12.0' }; const API_URL = 'https://orkutapi.andyyuda41.workers.dev/api/qris-history'; module.exports = { buildPayload, headers, API_URL }; // Check for incoming payments const checkPayments = async () => { try { const response = await axios.post(API_URL, buildPayload(), { headers }); if (response.data && response.data.data) { const payments = response.data.data; // Match payments with pending deposits payments.forEach(payment => { const amount = parseInt(payment.amount); db.get('SELECT * FROM pending_deposits WHERE amount = ? AND status = "pending"', [amount], (err, deposit) => { if (deposit) { // Payment found - credit user account db.run('UPDATE users SET saldo = saldo + ? WHERE user_id = ?', [deposit.original_amount, deposit.user_id] ); // Update deposit status db.run('UPDATE pending_deposits SET status = "completed" WHERE unique_code = ?', [deposit.unique_code] ); // Notify user bot.telegram.sendMessage(deposit.user_id, `โ Pembayaran Rp ${deposit.original_amount} telah diterima!\nSaldo Anda: Rp ${deposit.original_amount}` ); } } ); }); } } catch (error) { console.error('Payment check failed:', error.message); } }; // Run payment check every 30 seconds setInterval(checkPayments, 30000); ``` -------------------------------- ### Express API Server for BotVPN Source: https://context7.com/arivpnstores/botvpn/llms.txt This Javascript code defines an Express.js server for BotVPN. It includes endpoints for health checks, handling Telegram webhooks, and retrieving server information from a database. It requires `express` and a database connection (`db`). ```javascript const express = require('express'); const app = express(); app.use(express.json()); app.use(express.urlencoded({ extended: true })); // Health check endpoint app.get('/health', (req, res) => { res.json({ status: 'ok', uptime: process.uptime() }); }); // Webhook endpoint for Telegram app.post(`/webhook/${BOT_TOKEN}`, (req, res) => { bot.handleUpdate(req.body); res.sendStatus(200); }); // Server info endpoint app.get('/api/servers', (req, res) => { db.all('SELECT id, nama_server, domain, harga, total_create_akun, batas_create_akun FROM Server', (err, rows) => { if (err) { res.status(500).json({ error: err.message }); } else { res.json({ servers: rows }); } } ); }); // Start server const PORT = process.env.PORT || 6969; app.listen(PORT, () => { console.log(`Server running on port ${PORT}`); }); ``` -------------------------------- ### Telegram Webhook Endpoint Source: https://context7.com/arivpnstores/botvpn/llms.txt Receives updates from Telegram and forwards them to the BotVPN bot handler. ```APIDOC ## POST /webhook/{BOT_TOKEN} ### Description This endpoint is used by Telegram to send updates to the BotVPN bot. The bot's `handleUpdate` method processes these updates. ### Method POST ### Endpoint `/webhook/{BOT_TOKEN}` ### Parameters #### Path Parameters - **BOT_TOKEN** (string) - Required - The unique token for your Telegram bot. #### Query Parameters None #### Request Body - **update** (object) - Required - The update object received from Telegram. ### Request Example (Telegram sends this, not directly used by client) ```json { "update_id": 123456789, "message": { "date": 1678886400, "chat": { "id": 123456789, "type": "private", "username": "testuser" }, "text": "/start", "message_id": 1, "from": { "id": 123456789, "is_bot": false, "first_name": "Test", "username": "testuser" } } } ``` ### Response #### Success Response (200) Indicates that the update was received and processed successfully by the server. #### Response Example (No body, only status code) 200 OK ``` -------------------------------- ### Unlock SSH Account with JavaScript Source: https://context7.com/arivpnstores/botvpn/llms.txt Re-enables a previously locked SSH account, restoring its full access. This function requires credentials and duration, and is part of the 'unlock' module. Similar unlock functions exist for other protocols. ```javascript const { unlockssh, unlockvmess } = require('./modules/unlock'); // Unlock SSH account const result = await unlockssh('john123', 'password', 30, 2, 1); ``` -------------------------------- ### Health Check Endpoint Source: https://context7.com/arivpnstores/botvpn/llms.txt Provides a health check for the BotVPN Express server. Returns the status and uptime of the server. ```APIDOC ## GET /health ### Description Checks the health status of the BotVPN Express server. It returns a JSON object with the server's status and uptime. ### Method GET ### Endpoint /health ### Parameters None ### Request Example None ### Response #### Success Response (200) - **status** (string) - The health status of the server (e.g., "ok"). - **uptime** (number) - The uptime of the server in seconds. #### Response Example ```json { "status": "ok", "uptime": 12345.67 } ``` ``` -------------------------------- ### Delete VMess Account with JavaScript Source: https://context7.com/arivpnstores/botvpn/llms.txt Permanently removes a VMess account from the server. This operation requires the username and other parameters for deletion. It is managed by a 'del' module. ```javascript const { delvmess } = require('./modules/del'); // Delete VMess account const result = await delvmess('user456', 30, 50, 0, 1); ``` -------------------------------- ### Renew SSH Account with JavaScript Source: https://context7.com/arivpnstores/botvpn/llms.txt Renews an existing SSH account, extending its expiration date without altering credentials. It requires the username and duration for renewal. The function is part of a 'renew' module. ```javascript const { renewssh } = require('./modules/renew'); // Renew SSH account for additional 30 days const result = await renewssh('john123', 30, 2, 1); ``` -------------------------------- ### Lock SSH Account with JavaScript Source: https://context7.com/arivpnstores/botvpn/llms.txt Temporarily disables an SSH account, preventing new connections without deleting the account. This function requires the username, password, duration, and other relevant parameters. It is part of the 'lock' module. ```javascript const { lockssh, lockvmess, lockvless, locktrojan } = require('./modules/lock'); // Lock SSH account const result = await lockssh('john123', 'password', 30, 2, 1); // Lock VMess account await lockvmess('user456', 30, 50, 0, 1); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.