kkapil9112/Hguuuuuv45botPublic · Bot Template

AITelegram commerce bot for an admin-managed digital store: admins create categories, products, time-based plans, stock entries and license keys, and can grant reseller roles or adjust user balances. End users can view their balance, start a deposit flow with an inline amount keypad, apply coupon codes, and navigate back to the store menu. It uses Bot properties for product/stock/coupon data and Libs.ResourcesLib for per-user balances.

Commercecommerceshopreselleradmin-panelbalanceproduct-management
ProfileTelegram
102 commands0 envUpdated 29d agoCreated Aug 7, 2026
Back to folder

commands/_addbal.js

javascript · 77 lines

Raw
1/**#command2name: /addbal3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12let admin_id = "8812621370"; 13 14if (user.telegramid == admin_id) {15    16    let params = (typeof message !== "undefined" && message) ? message.split(" ") : [];17    let data = params[1]; 18    19    // ✅ FIXED: pehle "Add Bal" admin-panel button dabane par ye seedha "Wrong20    // Format" error de deta tha (kyunki button koi text argument nahi bhejta),21    // aur admin ko turant type karna padta tha "/addbal id|amount" khud se.22    // Ab button dabane par ek proper prompt aata hai aur agla text message23    // auto-capture ho jaata hai (see _start.js "MODULE 5").24    if (!data || !data.includes("|")) {25        User.setProperty("addbal_step", "waiting_input", "string");26        Bot.sendMessage(27            "<tg-emoji emoji-id='5409048419211682843'>💵</tg-emoji> <b>Add Balance</b>\n\n" +28            "<i>User ID aur amount is format me reply karein:</i>\n<code>user_id|amount</code>\n\n" +29            "<i>Example:</i> <code>6191635812|100</code>",30            {parse_mode: "HTML"}31        );32        return;33    }34    35    let splitData = data.split("|");36    let targetUserId = splitData[0].trim();37    let amountToAdd = parseFloat(splitData[1].trim());38    39    if (isNaN(amountToAdd)) {40        Bot.sendMessage("❌ *Invalid Amount!*", {parse_mode: "Markdown"});41        return;42    }43    44    try {45        // Balance add karna46        let targetUserBalance = Libs.ResourcesLib.anotherUserRes("balance", targetUserId);47        targetUserBalance.add(amountToAdd);48        49        // Admin notification50        Bot.sendMessage("✅ Success! Added " + amountToAdd + " to user " + targetUserId);51        52        // All 4 Premium Emojis in Quote Style53        let notificationText = 54            "<blockquote>" +55            "<tg-emoji emoji-id='6192822213486321961'>🗣</tg-emoji> Admin Added: " + amountToAdd + "\n" +56            "<tg-emoji emoji-id='6266967801580231067'>💎</tg-emoji> Balance Credited!\n" +57            "<tg-emoji emoji-id='6267068789146260253'>💰</tg-emoji> Wallet Updated\n" +58            "<tg-emoji emoji-id='5866053971960929280'>🛒</tg-emoji> /start TO SHOP NOW" +59            "</blockquote>";60            61        // Direct Telegram API Method62        HTTP.post({63            url: "https://api.telegram.org/bot" + bot.token + "/sendMessage",64            body: {65                chat_id: targetUserId,66                text: notificationText,67                parse_mode: "HTML"68            }69        });70        71    } catch (err) {72        Bot.sendMessage("⚠️ *Error:* " + err.message, {parse_mode: "Markdown"});73    }74 75} else {76    Bot.sendMessage("❌ You are not authorized to use this command.");77}