indrajitghosh20006/Testseller_01botPublic · Bot Template

ProfileTelegram

AIThis bot provides an admin‑controlled system for managing user balances, products, and reseller roles. It includes commands to add balances (via manual input, Binance Pay, or UPI), approve and credit payments, and set up product listings with categories and pricing. Admins can also add resellers, view reseller info, and manage stock entries. The bot uses built‑in TeleBotHost APIs such as Bot, Api, HTTP, and Libs for database operations and message handling.

Commerceadminbalanceproductresellerpaymentsbinance
138 commands0 envUpdated 17h agoCreated Sep 27, 2026
Back to folder

commands/_onDeepLinkPlanShow.js

javascript · 98 lines

Raw
1/**#command2name: /onDeepLinkPlanShow3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12try {13  var userId = user.telegramid;14  var chatId = User.getProperty("dl_wait_chatid") || chat.chatid;15  var loadingMsgId = User.getProperty("dl_wait_msgid");16  var matchedIdx = Number(User.getProperty("dl_wait_prodidx"));17 18  var productList = Bot.getProperty("stored_products") || [];19  var product = productList[matchedIdx];20 21  if (!product) {22    Bot.sendMessage("⚠️ Product data mismatch, dobara try karein.");23    return;24  }25 26  var isResellerDL = Bot.getProperty("is_reseller_" + userId) === true;27  var planButtons = [];28  var plans = product.plans || [];29 30  if (plans.length === 0) {31    plans = [32      { days: "1", normal_price: "79", reseller_price: "65" },33      { days: "7", normal_price: "350", reseller_price: "300" }34    ];35  }36 37  for (var j = 0; j < plans.length; j++) {38    var plan = plans[j];39    var cleanProdName = product.name.trim().toUpperCase();40    var cleanPlanDays = String(plan.days).replace(/[^0-9]/g, "").trim();41 42    var normalKey = "price_normal_" + cleanProdName + "_" + cleanPlanDays;43    var resellerKey = "price_reseller_" + cleanProdName + "_" + cleanPlanDays;44 45    var adminNormalPrice = Bot.getProperty(normalKey);46    var adminResellerPrice = Bot.getProperty(resellerKey);47 48    var currentNormal = (adminNormalPrice !== undefined && adminNormalPrice !== null) ? adminNormalPrice : plan.normal_price;49    var currentReseller = (adminResellerPrice !== undefined && adminResellerPrice !== null) ? adminResellerPrice : plan.reseller_price;50 51    var displayPrice = isResellerDL ? currentReseller : currentNormal;52 53    planButtons.push([{54      text: plan.days + " DAYS ➔ " + displayPrice + "₹",55      callback_data: "/buyitem " + matchedIdx + " " + j,56      style: "success",57      icon_custom_emoji_id: "5866053971960929280"58    }]);59  }60 61  planButtons.push([{62    text: "Back to Products",63    callback_data: "/buy_hack",64    style: "danger",65    icon_custom_emoji_id: "5893163582194978381"66  }]);67 68  var productEmojiId = product.emoji || "6266967801580231067";69 70  var productDLMsg = "<blockquote><tg-emoji emoji-id='6102856637343600044'>👑</tg-emoji> <b>PRODUCT: " + product.name.toUpperCase() + "</b></blockquote>\n\n" +71    "<tg-emoji emoji-id='6093677128295914531'>✏️</tg-emoji> <b>CHOOSE YOUR PLAN</b> <tg-emoji emoji-id='6093677128295914531'>✏️</tg-emoji>\n\n" +72    "<blockquote><tg-emoji emoji-id='6093854128193152827'>🎉</tg-emoji> Select your validity plan below to proceed with the secure order <tg-emoji emoji-id='6091571559233755994'>👉</tg-emoji></blockquote>";73 74  if (loadingMsgId) {75    Api.editMessageText({76      chat_id: String(chatId),77      message_id: Number(loadingMsgId),78      text: productDLMsg,79      parse_mode: "HTML",80      reply_markup: JSON.stringify({ inline_keyboard: planButtons })81    });82  } else {83    Api.sendMessage({84      chat_id: String(chatId),85      text: productDLMsg,86      parse_mode: "HTML",87      reply_markup: JSON.stringify({ inline_keyboard: planButtons })88    });89  }90 91  // cleanup92  User.setProperty("dl_wait_msgid", null, "number");93  User.setProperty("dl_wait_prodidx", null, "number");94  User.setProperty("dl_wait_chatid", null, "string");95 96} catch (err) {97  Bot.sendMessage("⚠️ Delay Callback Error: " + err.message);98}