devbro468/Dev_x_store_botPublic · Bot Template

AIThis bot operates a digital storefront (DEV X STORE) selling subscription-based products — likely game hacks, accounts, or access keys — categorized by platform (Android Root, Non-Root, iPhone). It features a reseller program with discounted pricing, a dual-currency wallet (INR balance + Telegram Stars/XTR), and a full admin/co-admin panel for managing products, plans, per-plan pricing, stock (keys/accounts), coupons, and API endpoints. Purchases flow through a plan selection screen offering wallet payment, Stars invoices (sendInvoice with XTR currency), and coupon application. Successful Stars payments are handled via successful_payment webhook, crediting wallet or delivering keys directly. Admin tools include user listing with chunked messaging, stock viewing/deletion with inline keyboards, co-admin management, and API registry updates. The bot registers users on first interaction and

Commercecommercedigital-goodsstars-paymentreseller-systemadmin-panelstock-management
ProfileTelegram
119 commands0 envUpdated 15d agoCreated Aug 23, 2026
Back to folder

commands/_rembal.js

javascript · 84 lines

Raw
1/**#command2name: /rembal3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12// ✅ FIXED (v3): dynamic owner_id + co-admin check (same fix as /addbal).13let admin_id = Bot.getProperty("owner_id") || "8875810358";14let requesterId = String(user.telegramid);15let isCoAdmin = Bot.getProperty("co_admin_" + requesterId);16 17if (requesterId === admin_id || isCoAdmin) {18 19    // ✅ FIXED: instantly ack the button press so it doesn't feel stuck/slow.20    if (request && request.id) {21        try {22            HTTP.post({23                url: "https://api.telegram.org/bot" + bot.token + "/answerCallbackQuery",24                body: { callback_query_id: request.id }25            });26        } catch (ackErr) {}27    }28 29    let params = (typeof message !== "undefined" && message) ? message.split(" ") : [];30    let data = params[1];31 32    // ✅ FIXED: same button-click bug as /addbal — ab prompt aata hai.33    if (!data || !data.includes("|")) {34        User.setProperty("rembal_step", "waiting_input", "string");35        Bot.sendMessage(36            "<tg-emoji emoji-id='5409048419211682843'>💵</tg-emoji> <b>Remove Balance</b>\n\n" +37            "<i>User ID aur amount is format me reply karein:</i>\n<code>user_id|amount</code>\n\n" +38            "<i>Example:</i> <code>8875810358|50</code>",39            {parse_mode: "HTML"}40        );41        return;42    }43 44    let splitData = data.split("|");45    let targetUserId = splitData[0].trim();46    let amountToRemove = parseFloat(splitData[1].trim());47 48    if (!targetUserId || isNaN(amountToRemove) || amountToRemove <= 0) {49        Bot.sendMessage("❌ *Invalid Format! Use:* `user_id|amount`", {parse_mode: "Markdown"});50        return;51    }52 53    try {54        // Balance remove/deduct karna55        let targetUserBalance = Libs.ResourcesLib.anotherUserRes("balance", targetUserId);56        targetUserBalance.remove(amountToRemove);57 58        // Admin notification59        Bot.sendMessage("✅ Success! Removed " + amountToRemove + " from user " + targetUserId, {parse_mode: "HTML"});60 61        // New 3 Premium Emojis in Quote Style62        let notificationText =63            "<blockquote>" +64            "<tg-emoji emoji-id='5893163582194978381'>❌</tg-emoji> Admin Remove: " + amountToRemove + "\n" +65            "<tg-emoji emoji-id='6071272104978814192'>😞</tg-emoji> Check your balance now\n" +66            "<tg-emoji emoji-id='5257963315258204021'>ℹ️</tg-emoji> Use /balance To Check" +67            "</blockquote>";68 69        // ✅ FIXED: raw HTTP.post ki jagah Api.sendMessage — zyada reliable delivery.70        try {71            Api.sendMessage({72                chat_id: targetUserId,73                text: notificationText,74                parse_mode: "HTML"75            });76        } catch (notifyErr) {}77 78    } catch (err) {79        Bot.sendMessage("⚠️ *Error:* " + err.message, {parse_mode: "Markdown"});80    }81 82} else {83    Bot.sendMessage("❌ You are not authorized to use this command.");84}