mansuriamaan803/SANJEEVFFSTORE_botPublic · Bot Template

AIThis bot is a commerce platform for selling digital products, primarily focused on FreeFire accounts and related services. It provides admin tools for managing products, categories, stock, reseller roles, and a balance system for user payments. Users can browse products, apply coupons, and check their balance through an interactive interface with premium emojis and inline keyboards.

Commercecommercestoreproductsresellerbalancecoupon
ProfileTelegram
102 commands0 envUpdated 12d agoCreated Aug 26, 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 = "8963001413"; 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>8963001413|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}