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/_back.js
javascript · 170 lines
1/**#command2name: /back3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12// =========================================================13// 🚀 PREMIUM STORE MASTER DASHBOARD (UPDATED WITH LUDO SPIN)14// STATUS: 100% PRODUCTION READY WITH LIVE BUTTON STYLES15// =========================================================16 17try {18 var userId = user.telegramid;19 20 // 💾 BROADCAST SYSTEM: Safe Loop Core21 var userList = [];22 try {23 userList = Bot.getProperty("all_users_list") || [];24 if (!Array.isArray(userList)) { userList = []; }25 } catch (propErr) {26 userList = [];27 }28 29 var userExists = false;30 for (var i = 0; i < userList.length; i++) {31 if (String(userList[i]) === String(userId)) {32 userExists = true;33 break;34 }35 }36 if (!userExists) {37 userList.push(String(userId));38 Bot.setProperty("all_users_list", userList, "json");39 }40 41 // 📊 REAL BALANCE FETCH42 var userBal = "0.00";43 try {44 var res = 0;45 if (Libs && Libs.ResourcesLib) {46 res = Libs.ResourcesLib.userRes("balance").value() || 0;47 }48 userBal = Number(res).toFixed(2);49 } catch (balErr) {50 userBal = Number(res || 0).toFixed(2);51 }52 53 // 💎 CANONICAL WELCOME — exactly the same on /start, /menu and /back.54 // Do not read custom_welcome_text here; this prevents old/new welcome glitches.55 var BOT_DISPLAY_NAME = "GOLDEN SELLING STORE";56 var U = {57 shop: "<tg-emoji emoji-id='5866053971960929280'>🛒</tg-emoji>",58 update: "<tg-emoji emoji-id='5208790878931415568'>🔄</tg-emoji>",59 money: "<tg-emoji emoji-id='5409048419211682843'>💰</tg-emoji>",60 profile: "<tg-emoji emoji-id='6145572393499762737'>⚙️</tg-emoji>",61 refer: "<tg-emoji emoji-id='5823654080584618403'>🔗</tg-emoji>",62 how: "<tg-emoji emoji-id='6192842983948162969'>❗</tg-emoji>",63 support: "<tg-emoji emoji-id='6267129592998270736'>✈️</tg-emoji>",64 gift: "<tg-emoji emoji-id='6194922667242429131'>🎁</tg-emoji>",65 balance: "<tg-emoji emoji-id='5231200819986047254'>💰</tg-emoji>",66 arrow: "<tg-emoji emoji-id='6057415823222379852'>👇</tg-emoji>"67 };68 var welcomeMessage =69 "<blockquote>" + U.shop + " <b>" + BOT_DISPLAY_NAME + "</b> " + U.shop + "</blockquote>\n" +70 "➤ ───────────────────\n" +71 "├ " + U.shop + " <b>Buy Now</b> : All Key Purchase & Instant Delivery\n" +72 "├ " + U.update + " <b>Check Update</b> : Check Setup Video And Update Apk\n" +73 "├ " + U.money + " <b>Add Balance</b> : Deposit Balance & Secure Auto-Add Payment System\n" +74 "├ " + U.profile + " <b>My Profile + All History</b> : Check Your Account Information + All History\n" +75 "├ " + U.refer + " <b>Refer And Earn</b> : Share Refer Link & Earn Money\n" +76 "├ " + U.how + " <b>How To Use Bot</b> : View Tutorial And Work This Bot\n" +77 "├ " + U.support + " <b>Support</b> : Bot Problem Fixed For Support Admin\n" +78 "├ " + U.gift + " <b>Daily Gift</b> : Free Spin and win random balance daily, Only one spin every 24 hours.\n" +79 "➤ ───────────────────\n" +80 "<blockquote>" + U.balance + " <b>Your Balance:</b> ₹" + userBal + "</blockquote>\n" +81 "➤ ───────────────────\n" +82 U.arrow + " <b>Select an option from the menu below:</b>";83 84 var MENU_EMOJI = {85 shop: Bot.getProperty("menu_emoji_shop") || "5866053971960929280",86 download: Bot.getProperty("menu_emoji_download") || "5208790878931415568",87 addfund: Bot.getProperty("menu_emoji_addfund") || "5409048419211682843",88 profile: Bot.getProperty("menu_emoji_profile") || "6145572393499762737",89 refer: Bot.getProperty("menu_emoji_refer") || "5823654080584618403",90 how: Bot.getProperty("menu_emoji_how") || "6192842983948162969",91 support: Bot.getProperty("menu_emoji_support") || "6267129592998270736",92 dailygift: Bot.getProperty("menu_emoji_dailygift") || "6194922667242429131",93 proof: Bot.getProperty("menu_emoji_proof") || "5330237710655306682",94 reseller: Bot.getProperty("menu_emoji_reseller") || "6102856637343600044"95 };96 97 // ONE canonical main menu. All entry points (/start, /menu, /back and98 // post-verification) use the same keyboard so the layout never switches.99 var multiColorKeyboard = [100 [{ text: "𝑩𝒖𝒚 𝑵𝒐𝒘", callback_data: "/buy_hack", style: "danger", icon_custom_emoji_id: MENU_EMOJI.shop }],101 [102 { text: "𝑪𝒉𝒆𝒄𝒌 𝑼𝒑𝒅𝒂𝒕𝒆", callback_data: "/download_updates", style: "success", icon_custom_emoji_id: MENU_EMOJI.download },103 { text: "𝑨𝒅𝒅 𝑩𝒂𝒍𝒂𝒏𝒄𝒆", callback_data: "/addfund", style: "primary", icon_custom_emoji_id: MENU_EMOJI.addfund }104 ],105 [{ text: "𝑴𝒚 𝑷𝒓𝒐𝒇𝒊𝒍𝒆 + 𝑨𝒍𝒍 𝑯𝒊𝒔𝒕𝒐𝒓𝒚", callback_data: "/profile", style: "success", icon_custom_emoji_id: MENU_EMOJI.profile }],106 [107 { text: "𝑹𝒆𝒇𝒆𝒓 𝑨𝒏𝒅 𝑬𝒂𝒓𝒏", callback_data: "/refer", style: "success", icon_custom_emoji_id: MENU_EMOJI.refer },108 { text: "𝑯𝒐𝒘 𝑻𝒐 𝑼𝒔𝒆 𝑩𝒐𝒕", callback_data: "/how", style: "primary", icon_custom_emoji_id: MENU_EMOJI.how }109 ],110 [111 { text: "𝑺𝒖𝒑𝒑𝒐𝒓𝒕", callback_data: "/support", style: "danger", icon_custom_emoji_id: MENU_EMOJI.support },112 { text: "𝑫𝒂𝒊𝒍𝒚 𝑮𝒊𝒇𝒕", callback_data: "/dailygift", style: "success", icon_custom_emoji_id: MENU_EMOJI.dailygift }113 ],114 [{ text: "𝑷𝒂𝒚𝒎𝒆𝒏𝒕 𝑷𝒓𝒐𝒐𝒇𝒔", url: (Bot.getProperty("payment_proof_link") || "https://t.me/GaluModz_Proof"), style: "success", icon_custom_emoji_id: MENU_EMOJI.proof }]115 ];116 117 if (Bot.getProperty("reseller_system_enabled") && !Bot.getProperty("is_reseller_" + userId)) {118 multiColorKeyboard.push([119 { text: "𝑹𝒆𝒔𝒆𝒍𝒍𝒆𝒓 𝑼𝒑𝒈𝒓𝒂𝒅𝒆", callback_data: "/reseller_upgrade", style: "success", icon_custom_emoji_id: MENU_EMOJI.reseller }120 ]);121 }122 123 // 👑 Conditional Reseller Upgrade button124 125 // 🔄 Safe Callback Loading Controller126 var queryId = null;127 if (request) {128 if (request.id) { queryId = request.id; }129 else if (request.callback_query && request.callback_query.id) { queryId = request.callback_query.id; }130 }131 132 if (queryId) {133 try { Api.answerCallbackQuery({ callback_query_id: queryId }); } catch(qErr){}134 }135 136 // ⚡ Native Execution Route (Send vs Edit Handler)137 // ✅ BUG FIX: agar previous message ek PHOTO thi (jaise DP-attached Profile),138 // Telegram editMessageText use hi nahi kar sakta uspar — isi wajah se Profile139 // se "Back" click karne par kuch hota hi nahi tha. Ab photo ho to delete karke140 // fresh text message bheja jaata hai.141 if (request && request.message && request.message.message_id) {142 if (request.message.photo) {143 try { Api.deleteMessage({ chat_id: chat.chatid, message_id: request.message.message_id }); } catch (delErr) {}144 Api.sendMessage({145 chat_id: chat.chatid,146 text: welcomeMessage,147 parse_mode: "HTML",148 reply_markup: JSON.stringify({ inline_keyboard: multiColorKeyboard })149 });150 } else {151 Api.editMessageText({152 chat_id: chat.chatid,153 message_id: request.message.message_id,154 text: welcomeMessage,155 parse_mode: "HTML",156 reply_markup: JSON.stringify({ inline_keyboard: multiColorKeyboard })157 });158 }159 } else {160 Api.sendMessage({161 chat_id: chat.chatid,162 text: welcomeMessage,163 parse_mode: "HTML",164 reply_markup: JSON.stringify({ inline_keyboard: multiColorKeyboard })165 });166 }167 168} catch (globalException) {169 Bot.sendMessage("🛑 <b>Dashboard Debug Error:</b> <code>" + globalException.message + "</code>", { parse_mode: "HTML" });170}