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

javascript · 75 lines

Raw
1/**#command2name: /set_sale_channel_btn3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12// =========================================================13// ✅ ADMIN PANEL BUTTON — "Set Sale Channel"14// Pressing this button prompts the admin to send the channel's numeric15// chat_id next; _start.js (MODULE 5) auto-captures that reply and forwards16// it to /set_sale_channel internally. This channel gets the "New Sale!"17// announcement whenever a manual (no-PID) order's key is delivered.18// =========================================================19 20try {21  var adminId = Bot.getProperty("owner_id") || "8477746023";22  var currentChatId = String(chat.chatid);23  var isCoAdmin = Bot.getProperty("co_admin_" + currentChatId);24 25  if (currentChatId !== adminId && !isCoAdmin) {26    Bot.sendMessage("❌ You are not authorized to use this.");27    return;28  }29 30  var currentChannel = Bot.getProperty("sale_channel_id") || "-1003901057163 (default)";31 32    // ✅ FIXED: agar koi PURANA admin step atka reh gaya tha (jaise Add33  // Balance wizard adhoora chhoda gaya), to naya step set karne se pehle34  // sabhi purane step-flags clear kar do — warna agla text message galat35  // handler me chala jaata tha aur ye naya flow kaam hi nahi karta tha.36  var __allAdminSteps = ["addbal_step","addbalall_step","rembal_step","checkbal_step",37    "set_download_link_step","set_payment_upi_step","set_payment_binance_step",38    "set_dailygift_price_step","set_refer_earn_step","set_how_link_step",39    "set_proof_link_step","set_support_link_step","give_key_step",40    "set_sale_channel_step","set_menu_emoji_step","set_welcome_message_step",41    "add_product_step"];42  for (var __si = 0; __si < __allAdminSteps.length; __si++) { User.setProperty(__allAdminSteps[__si], null, "string"); }43 44  User.setProperty("set_sale_channel_step", "waiting_input", "string");45 46  var promptText =47    "<blockquote>📢 <b>Set Sale Announcement Channel</b></blockquote>\n\n" +48    "<i>Jis channel me har manual key delivery ke baad \"New Sale!\" announcement jaani chahiye, uski numeric</i> <b>chat_id</b> <i>bhejein.</i>\n\n" +49    "<i>Chat ID nikalne ke liye channel me koi bhi message forward karke</i> <code>@userinfobot</code> <i>ko bhej dein, ya channel ko is bot ka admin banane ke baad</i> <code>@RawDataBot</code> <i>use karein.</i>\n\n" +50    "<b>Example:</b> <code>-1003901057163</code>\n\n" +51    "<b>Current channel:</b> <code>" + currentChannel + "</code>";52 53  var queryId = request ? (request.id || (request.callback_query && request.callback_query.id)) : null;54 55  if (request && request.message && request.message.message_id) {56    try {57      Api.editMessageText({58        chat_id: String(chat.chatid),59        message_id: Number(request.message.message_id),60        text: promptText,61        parse_mode: "HTML",62        reply_markup: JSON.stringify({ inline_keyboard: [[{ text: "Cancel", callback_data: "/admin", style: "danger" }]] })63      });64    } catch (e) {65      Api.sendMessage({ chat_id: chat.chatid, text: promptText, parse_mode: "HTML" });66    }67  } else {68    Bot.sendMessage(promptText, { parse_mode: "HTML" });69  }70 71  if (queryId) { try { Api.answerCallbackQuery({ callback_query_id: String(queryId) }); } catch (e) {} }72 73} catch (err) {74  Bot.sendMessage("⚠️ Error: " + err.message);75}