ayushyadav7970824760/goldensellingstore_botPublic · Bot Template

AIThis Telegram store bot lets customers browse digital products and plans, apply coupons, add funds via UPI, and receive purchased keys. It includes a full admin panel for managing products, reordering items, setting reseller prices, viewing and removing key stock, configuring UPI payment details and update links, and checking user balances. Co-admins and resellers are supported, and support tickets are forwarded to the admin.

Commercedigital_storeadmin_panelupi_paymentsresellercouponskey_stock
ProfileTelegram
146 commands0 envUpdated 2d agoCreated Sep 5, 2026
Back to folder

commands/_reorder_products.js

javascript · 89 lines

Raw
1/**#command2name: /reorder_products3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12// =========================================================13// 🔀 ADMIN PANEL — "Reorder Products"14// Har product ke saath ⬆️/⬇️ button — dabate hi wo product list me ek15// position upar/neeche khisak jaata hai. Store me products isi order me16// dikhte hain.17// =========================================================18 19try {20  var adminId = Bot.getProperty("owner_id") || "8477746023";21  var isCoAdmin0 = Bot.getProperty("co_admin_" + String(chat.chatid));22  if (String(chat.chatid) !== adminId && !isCoAdmin0) {23    Bot.sendMessage("❌ You are not authorized to use this.");24    return;25  }26 27  var callbackId = request ? (request.id || (request.callback_query && request.callback_query.id)) : null;28 29  var productList = Bot.getProperty("stored_products") || [];30  if (!Array.isArray(productList)) { productList = []; }31 32  // params format: "up <idx>" ya "down <idx>"33  var actionParams = params ? String(params).trim().split(" ") : [];34  if (actionParams.length === 2) {35    var dir = actionParams[0];36    var idx = Number(actionParams[1]);37    if (dir === "up" && idx > 0 && idx < productList.length) {38      var tmp = productList[idx - 1];39      productList[idx - 1] = productList[idx];40      productList[idx] = tmp;41      Bot.setProperty("stored_products", productList, "json");42    } else if (dir === "down" && idx >= 0 && idx < productList.length - 1) {43      var tmp2 = productList[idx + 1];44      productList[idx + 1] = productList[idx];45      productList[idx] = tmp2;46      Bot.setProperty("stored_products", productList, "json");47    }48    if (callbackId) { try { Api.answerCallbackQuery({ callback_query_id: String(callbackId) }); } catch (e) {} }49  }50 51  if (productList.length === 0) {52    Bot.sendMessage("⚠️ Koi products add nahi kiye gaye hain abhi tak.", { parse_mode: "HTML" });53    return;54  }55 56  var text = "<blockquote>🔀 <b>REORDER PRODUCTS</b></blockquote>\n\n" +57    "<i>⬆️/⬇️ dabakar kisi bhi product ki position badal sakte hain — jo order yahan hai, wahi store me dikhega.</i>\n\n";58 59  var rows = [];60  for (var i = 0; i < productList.length; i++) {61    var p = productList[i];62    if (!p) { continue; }63    rows.push([64      { text: (i + 1) + ". " + p.name, callback_data: "/reorder_products noop", style: "primary" },65      { text: "⬆️", callback_data: "/reorder_products up " + i, style: "success" },66      { text: "⬇️", callback_data: "/reorder_products down " + i, style: "danger" }67    ]);68  }69  rows.push([{ text: "Back to Admin Panel", callback_data: "/admin", style: "primary" }]);70 71  if (request && request.message && request.message.message_id) {72    try {73      Api.editMessageText({74        chat_id: String(chat.chatid),75        message_id: Number(request.message.message_id),76        text: text,77        parse_mode: "HTML",78        reply_markup: JSON.stringify({ inline_keyboard: rows })79      });80    } catch (e) {81      Api.sendMessage({ chat_id: chat.chatid, text: text, parse_mode: "HTML", reply_markup: JSON.stringify({ inline_keyboard: rows }) });82    }83  } else {84    Bot.sendMessage(text, { parse_mode: "HTML", reply_markup: JSON.stringify({ inline_keyboard: rows }) });85  }86 87} catch (err) {88  Bot.sendMessage("⚠️ Error: " + err.message);89}