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
146 commands0 envUpdated 2d agoCreated Sep 5, 2026
commands/_.js
javascript · 80 lines
1/**#command2name: *3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12// =========================================================13// 🛡️ WILDCARD FALLBACK — catches any message/input that doesn't match14// a specific registered command.15// ✅ BUG FIX: pehle ye ek 241-line ka STALE duplicate copy tha (purani16// admin checks, plain crown emoji, koi bhi naya fix — maintenance mode,17// coupon wizard, case-insensitive /start — yahan nahi tha). Kyunki ye18// wildcard command hai, koi bhi unmatched input isi purane/buggy logic19// se guzarta tha. Ab ye seedha /start ko delegate karta hai (jahan sab20// latest fixes maujood hain) — koi duplicate/stale logic nahi bacha.21// =========================================================22 23try {24 // 📸 Admin product-logo upload handler25 var state = User.getProperty("admin_state");26 if (state === "wait_for_prod_logo" && request && request.photo && request.photo.length) {27 var adminId = String(Bot.getProperty("owner_id") || Bot.getProperty("admin_id") || "8477746023");28 var userId = String(user.telegramid);29 var isCoAdmin = Bot.getProperty("co_admin_" + userId) === true;30 31 if (userId !== adminId && !isCoAdmin) {32 User.setProperty("admin_state", null, "string");33 User.setProperty("admin_target_prod", null, "string");34 User.setProperty("admin_target_prod_index", null, "integer");35 Bot.sendMessage("❌ Only admin can upload product logos.");36 return;37 }38 39 var targetIndex = User.getProperty("admin_target_prod_index");40 var products = Bot.getProperty("stored_products");41 if (!Array.isArray(products)) products = [];42 43 var idx = Number(targetIndex);44 if (!isFinite(idx) || idx < 0 || idx >= products.length) {45 // Fallback to name match for safety.46 var targetName = String(User.getProperty("admin_target_prod") || "").trim().toLowerCase();47 idx = -1;48 for (var i = 0; i < products.length; i++) {49 if (products[i] && products[i].name &&50 String(products[i].name).trim().toLowerCase() === targetName) {51 idx = i;52 break;53 }54 }55 }56 57 if (idx >= 0 && products[idx]) {58 var fileId = request.photo[request.photo.length - 1].file_id;59 products[idx].logo = fileId;60 Bot.setProperty("stored_products", products, "json");61 62 Bot.sendMessage(63 "✅ <b>" + String(products[idx].name).replace(/&/g,"&").replace(/</g,"<") +64 "</b> ka logo successfully update ho gaya!",65 {parse_mode:"HTML"}66 );67 } else {68 Bot.sendMessage("❌ Product nahi mila. /setlogo dobara use karein.");69 }70 71 User.setProperty("admin_state", null, "string");72 User.setProperty("admin_target_prod", null, "string");73 User.setProperty("admin_target_prod_index", null, "integer");74 return;75 }76 77 Bot.run({ command: "/start" });78} catch (err) {79 try { Bot.sendMessage("⚠️ Kripya /start type karein.", { parse_mode: "HTML" }); } catch (e) {}80}