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/_removeplan.js

javascript · 90 lines

Raw
1/**#command2name: /removeplan3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12try {13  // Apni Admin Telegram ID yahan dalein14  var adminId = "8875810358";15 16  if (String(chat.chatid) !== adminId) {17    Bot.sendMessage("❌ You are not the admin!");18    return;19  }20 21  // Format validation verification22  if (!params) {23    Bot.sendMessage("⚠️ Format: `/removeplan PRODUCT NAME | DAYS`\n\n*Example:* `/removeplan FreeFire Hack | 1`", { parse_mode: "Markdown" });24    return;25  }26 27  var data = params.split("|");28  if (data.length < 2) {29    Bot.sendMessage("⚠️ Galat Format! Product Name aur Days '|' se alag honi chahiye.");30    return;31  }32 33  var pName = data[0].trim().toLowerCase();34  var pDays = data[1].trim();35 36  // Database se existing products list nikalna37  var productList = Bot.getProperty("stored_products") || [];38  var productIndex = -1;39 40  // 1. Pehle product find karein41  for (var i = 0; i < productList.length; i++) {42    if (productList[i].name.toLowerCase() === pName) {43      productIndex = i;44      break;45    }46  }47 48  if (productIndex === -1) {49    Bot.sendMessage("❌ Product **" + data[0].trim() + "** database me nahi mila!", { parse_mode: "Markdown" });50    return;51  }52 53  var product = productList[productIndex];54  var plans = product.plans || [];55  var planIndex = -1;56 57  // 2. Us product ke andar targeted plan find karein58  for (var j = 0; j < plans.length; j++) {59    if (String(plans[j].days) === pDays) {60      planIndex = j;61      break;62    }63  }64 65  if (planIndex === -1) {66    Bot.sendMessage("❌ Product me **" + pDays + " Days** wala koi plan nahi mila!", { parse_mode: "Markdown" });67    return;68  }69 70  // 3. Plan ko array se remove (delete) karna71  plans.splice(planIndex, 1);72 73  var feedbackMsg = "";74  75  // 4. Verification Check: Agar saare plans delete ho chuke hain, toh product hi remove kar do76  if (plans.length === 0) {77    productList.splice(productIndex, 1);78    feedbackMsg = "🗑️ Product **" + product.name + "** ka aakhri plan thha, isliye poora product list se remove ho gaya!";79  } else {80    productList[productIndex].plans = plans;81    feedbackMsg = "✅ Product **" + product.name + "** se **" + pDays + " Days** wala plan successfully remove ho gaya!";82  }83 84  // 5. Updated list database me save karna85  Bot.setProperty("stored_products", productList, "json");86  Bot.sendMessage(feedbackMsg, { parse_mode: "Markdown" });87 88} catch (err) {89  Bot.sendMessage("⚠️ Error: " + err.message);90}