indrajitghosh20006/Igstore_01botPublic Β· Bot Template

ProfileTelegram

AIThe bot provides an admin interface for a digital store, allowing the owner or co‑admins to add balances, products, plans, and categories. It supports payment workflows via UPI and Binance Pay, automatically generating QR codes and handling manual approval of deposits. The code patches inline keyboards to use premium emoji icons and includes helper functions for user and bot properties. Overall, it serves as a commerce management tool for a Telegram-based storefront.

Commercestoreadminbalanceproductplancategory
170 commands0 envUpdated 7h agoCreated Oct 30, 2026
Back to folder

commands/_reseller_upgrade.js

javascript Β· 62 lines

Raw
1/**#command2name: /reseller_upgrade3answer: 4keyboard: 5parse_mode: html6aliases: /reseller_vip7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12// Reseller VIP callback handler. Keep one command header so the host can13// register the callback reliably; do not monkey-patch JSON.stringify here.14try {15  var uid = String(user.telegramid);16  var cid = String(chat.chatid);17 18  // Acknowledge the inline button click immediately (Telegram callback query).19  try {20    var qid = request && (request.id || (request.callback_query && request.callback_query.id));21    if (qid) {22      HTTP.post({23        url: "https://api.telegram.org/bot" + bot.token + "/answerCallbackQuery",24        body: { callback_query_id: String(qid), text: "Opening Reseller VIP…", show_alert: false }25      });26    }27  } catch (ackErr) {}28 29  if (Bot.getProperty("is_reseller_" + uid)) {30    Bot.sendMessage("πŸ‘‘ You already have Reseller VIP access.");31  } else if (Bot.getProperty("reseller_system_enabled") !== true) {32    Bot.sendMessage("Reseller VIP is currently unavailable. Please contact the administrator.");33  } else {34    var price = Number(Bot.getProperty("reseller_upgrade_price") || Bot.getProperty("reseller_price") || 0);35    if (!(price > 0 && isFinite(price))) {36      Bot.sendMessage("Reseller VIP price is not configured yet. Please contact the administrator.");37    } else {38      var balance = 0;39      try { balance += Number(Libs.ResourcesLib.userRes("balance").value()) || 0; } catch (balErr) {}40      try { balance += Number(Bot.getProperty("balance" + uid)) || 0; } catch (bonusErr) {}41      var shortfall = Math.max(0, price - balance);42      var message =43        "πŸ‘‘ <b>RESELLER VIP UPGRADE</b>\n" +44        "━━━━━━━━━━━━━━━━━━━━\n\n" +45        "πŸ’Ž <b>One-time upgrade price:</b> β‚Ή" + price.toFixed(2) + "\n" +46        "πŸ’° <b>Your wallet balance:</b> β‚Ή" + balance.toFixed(2) + "\n\n" +47        "Benefits:\n" +48        "β€’ Reseller pricing on eligible products\n" +49        "β€’ Reseller access after successful upgrade\n\n" +50        (shortfall <= 051          ? "Your wallet balance is enough to upgrade. Tap below to confirm."52          : "Additional payment required: β‚Ή" + shortfall.toFixed(2) + " via UPI.") ;53      var keyboard = { inline_keyboard: [54        [{ text: shortfall <= 0 ? "Upgrade Using Wallet" : "Pay β‚Ή" + shortfall.toFixed(2) + " via UPI", callback_data: "/confirm_reseller_upgrade" }],55        [{ text: "Cancel", callback_data: "/back" }]56      ]};57      Bot.sendMessage(message, { parse_mode: "HTML", reply_markup: JSON.stringify(keyboard) });58    }59  }60} catch (err) {61  try { Bot.sendMessage("Reseller VIP could not be opened. Please try again or contact the administrator."); } catch (sendErr) {}62}