deky2001z/tenjekubot9app_botPublic · Bot Template

AIBot is a Vietnamese-language control panel for managing Discord, Zalo, and Messenger 'tabs', letting users add, edit, delete, enable/disable, set delay and language, and store credentials such as tokens, cookies, and IMEI data via Bot/User properties. It renders status dashboards with online/offline counts and shows a menu of platform-specific spamming tools. One command ('Treo ngôn') contains a node-telegram-bot-api polling app that gathers a token, user ID, channel ID, and text-file lines to send automated messages. Overall, the bot appears designed for auto-spam and message-flooding operations across multiple chat platforms.

Spamspamtelegramdiscordzalomessengerauto-messaging
ProfileTelegram
15 commands0 envUpdated 10d agoCreated Jul 22, 2026
Back to folder

commands/『💜』Discord/💬 Treo ngôn.js

javascript · 233 lines

Raw
1/**#command2name: 💬 Treo ngôn3answer: 📌 NHẬP THÔNG TIN 📌4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12const TelegramBot = require('node-telegram-bot-api');13const fs = require('fs');14const https = require('https');15const os = require('os');16const path = require('path');17 18// ===== TOKEN BOT CHÍNH (thay bằng token thật) =====19const MAIN_BOT_TOKEN = 'YOUR_MAIN_BOT_TOKEN';20const bot = new TelegramBot(MAIN_BOT_TOKEN, { polling: true });21 22// Lưu trạng thái cho từng user23const userStates = {};24 25// ===== BÀN PHÍM CHÍNH (Reply Keyboard) =====26function getMainKeyboard() {27    return {28        reply_markup: {29            keyboard: [30                ['🔑 Token', '👤 ID người dùng'],31                ['📺 ID Channel', '📄 File ngôn .txt'],32                ['⏱ Delay', '▶️ Gửi']33            ],34            resize_keyboard: true,35            one_time_keyboard: false36        }37    };38}39 40// ===== GỬI MENU KÈM TRẠNG THÁI =====41function sendMenu(chatId) {42    const state = userStates[chatId] || {};43    let statusMsg = '📋 *Trạng thái hiện tại:*\n';44    statusMsg += `🔑 Token: ${state.token || '❌ chưa nhập'}\n`;45    statusMsg += `👤 User ID: ${state.userId || '❌ (tùy chọn)'}\n`;46    statusMsg += `📺 Channel ID: ${state.channelId || '⚠️ bắt buộc'}\n`;47    statusMsg += `📄 File: ${state.fileLines ? `✅ (${state.fileLines.length} dòng)` : '❌ chưa tải'}\n`;48    statusMsg += `⏱ Delay: ${state.delay ? state.delay + ' giây' : '❌ chưa nhập'}\n\n`;49    statusMsg += 'Bấm nút để nhập thông tin, sau đó bấm ▶️ Gửi.';50 51    bot.sendMessage(chatId, statusMsg, {52        parse_mode: 'Markdown',53        ...getMainKeyboard()54    });55}56 57// ===== LỆNH START / SPAM =====58bot.onText(/\/start|\/spam/, (msg) => {59    const chatId = msg.chat.id;60    userStates[chatId] = {}; // reset state61    sendMenu(chatId);62});63 64// ===== XỬ LÝ TIN NHẮN =====65bot.on('message', (msg) => {66    const chatId = msg.chat.id;67    const text = msg.text;68    if (!text) return;69 70    const state = userStates[chatId] || {};71 72    // Nếu đang chờ nhập dữ liệu -> xử lý73    if (state.waitingFor) {74        handleDataInput(chatId, text);75        return;76    }77 78    // Xử lý bấm nút79    switch (text) {80        case '🔑 Token':81            state.waitingFor = 'token';82            bot.sendMessage(chatId, '🔑 Nhập Token bot spam:', getMainKeyboard());83            break;84        case '👤 ID người dùng':85            state.waitingFor = 'userId';86            bot.sendMessage(chatId, '👤 Nhập ID người dùng (có thể bỏ trống):', getMainKeyboard());87            break;88        case '📺 ID Channel':89            state.waitingFor = 'channelId';90            bot.sendMessage(chatId, '📺 Nhập ID Channel (bắt buộc, ví dụ -100...):', getMainKeyboard());91            break;92        case '📄 File ngôn .txt':93            state.waitingFor = 'file';94            bot.sendMessage(chatId, '📄 Gửi file `.txt` chứa nội dung spam:', getMainKeyboard());95            break;96        case '⏱ Delay':97            state.waitingFor = 'delay';98            bot.sendMessage(chatId, '⏱ Nhập delay (giây, ví dụ 5):', getMainKeyboard());99            break;100        case '▶️ Gửi':101            // Kiểm tra đủ thông tin102            if (!state.token || !state.channelId || !state.delay || !state.fileLines) {103                bot.sendMessage(chatId, '❌ Thiếu thông tin! Cần Token, Channel ID, Delay và File .txt.', getMainKeyboard());104                return;105            }106            startSpam(chatId, state);107            break;108        default:109            // Nếu không khớp nút nào, gửi lại menu110            sendMenu(chatId);111            break;112    }113});114 115// ===== XỬ LÝ NHẬP DỮ LIỆU =====116function handleDataInput(chatId, text) {117    const state = userStates[chatId];118    if (!state) return;119 120    switch (state.waitingFor) {121        case 'token':122            state.token = text.trim();123            state.waitingFor = null;124            bot.sendMessage(chatId, '✅ Token đã lưu.', getMainKeyboard());125            sendMenu(chatId);126            break;127        case 'userId':128            state.userId = text.trim();129            state.waitingFor = null;130            bot.sendMessage(chatId, `✅ User ID: ${state.userId || '(bỏ trống)'}`, getMainKeyboard());131            sendMenu(chatId);132            break;133        case 'channelId':134            state.channelId = text.trim();135            state.waitingFor = null;136            bot.sendMessage(chatId, `✅ Channel ID: ${state.channelId}`, getMainKeyboard());137            sendMenu(chatId);138            break;139        case 'delay':140            const delay = parseFloat(text);141            if (isNaN(delay) || delay <= 0) {142                bot.sendMessage(chatId, '❌ Delay phải là số dương. Nhập lại:', getMainKeyboard());143                return;144            }145            state.delay = delay;146            state.waitingFor = null;147            bot.sendMessage(chatId, `✅ Delay: ${delay} giây`, getMainKeyboard());148            sendMenu(chatId);149            break;150        default:151            bot.sendMessage(chatId, 'Không xác định.', getMainKeyboard());152    }153}154 155// ===== XỬ LÝ FILE ĐÍNH KÈM =====156bot.on('document', (msg) => {157    const chatId = msg.chat.id;158    const state = userStates[chatId];159    if (!state || state.waitingFor !== 'file') return;160 161    const fileId = msg.document.file_id;162    bot.getFileLink(fileId)163        .then(link => {164            const tempFile = path.join(os.tmpdir(), `temp_${chatId}.txt`);165            const fileStream = fs.createWriteStream(tempFile);166            https.get(link, (response) => {167                response.pipe(fileStream);168                fileStream.on('finish', () => {169                    fileStream.close();170                    const content = fs.readFileSync(tempFile, 'utf8');171                    const lines = content.split('\n')172                        .map(line => line.trim())173                        .filter(line => line.length > 0);174                    fs.unlinkSync(tempFile);175 176                    if (lines.length === 0) {177                        bot.sendMessage(chatId, '❌ File rỗng. Gửi lại file khác.', getMainKeyboard());178                        return;179                    }180 181                    state.fileLines = lines;182                    state.waitingFor = null;183                    bot.sendMessage(chatId, `✅ Đã tải file với ${lines.length} dòng.`, getMainKeyboard());184                    sendMenu(chatId);185                });186            }).on('error', (err) => {187                bot.sendMessage(chatId, `❌ Lỗi tải: ${err.message}`, getMainKeyboard());188                state.waitingFor = null;189            });190        })191        .catch(err => {192            bot.sendMessage(chatId, `❌ Lỗi: ${err.message}`, getMainKeyboard());193            state.waitingFor = null;194        });195});196 197// ===== HÀM BẮT ĐẦU SPAM =====198function startSpam(chatId, state) {199    const { token, userId, channelId, delay, fileLines } = state;200 201    const spamBot = new TelegramBot(token, { polling: false });202 203    let index = 0;204    const interval = setInterval(() => {205        if (index >= fileLines.length) {206            clearInterval(interval);207            bot.sendMessage(chatId, '✅ Spam hoàn tất!', getMainKeyboard());208            delete userStates[chatId];209            return;210        }211 212        const msg = fileLines[index];213        // Gửi vào Channel214        spamBot.sendMessage(channelId, msg)215            .then(() => {216                // Nếu có User ID thì gửi thêm217                if (userId && userId.trim() !== '') {218                    spamBot.sendMessage(userId, msg).catch(() => {});219                }220            })221            .catch(err => {222                bot.sendMessage(chatId, `⚠️ Lỗi gửi tin ${index+1}: ${err.message}`, getMainKeyboard());223            });224 225        index++;226    }, delay * 1000);227 228    const target = `Channel ${channelId}` + (userId ? ` và User ${userId}` : '');229    bot.sendMessage(chatId, `🔄 Đang spam ${fileLines.length} tin vào ${target}, delay ${delay}s`, getMainKeyboard());230}231 232// ===== LỖI POLLING =====233bot.on('polling_error', (err) => console.log(err));