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

javascript · 63 lines

Raw
1/**#command2name: /set_sale_channel3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12// =========================================================13// 🔧 ADMIN — Configure the channel that receives "New Sale!" announcements14// after a manual (no-PID) order's key is delivered.15// Usage: /set_sale_channel -100390105716316// =========================================================17 18try {19  var adminId = Bot.getProperty("owner_id") || "8477746023";20  var isCoAdmin0 = Bot.getProperty("co_admin_" + String(chat.chatid));21  if (String(chat.chatid) !== adminId && !isCoAdmin0) {22    Bot.sendMessage("❌ You are not the admin!");23    return;24  }25 26  if (!params || params.trim() === "") {27    var currentChannel = Bot.getProperty("sale_channel_id") || "-1003901057163 (default)";28    Bot.sendMessage(29      "⚠️ <b>Format:</b> <code>/set_sale_channel -1003901057163</code>\n\n" +30      "<b>Current channel:</b> <code>" + currentChannel + "</code>",31      { parse_mode: "HTML" }32    );33    return;34  }35 36  var input = params.trim();37 38  // Channel numeric IDs must be negative (-100xxxxxxxxxx). Auto-fix if39  // admin forgets the minus sign or the "-100" prefix.40  var cleanId = input.replace(/[^0-9-]/g, "");41  if (cleanId.indexOf("-") !== 0) {42    if (cleanId.indexOf("100") !== 0) {43      cleanId = "-100" + cleanId;44    } else {45      cleanId = "-" + cleanId;46    }47  }48 49  if (!/^-100[0-9]+$/.test(cleanId)) {50    Bot.sendMessage("❌ Invalid channel ID! Numeric channel chat_id bhejein, jaise <code>-1003901057163</code>.", { parse_mode: "HTML" });51    return;52  }53 54  Bot.setProperty("sale_channel_id", cleanId, "string");55  Bot.sendMessage(56    "✅ <b>Sale announcement channel update ho gaya:</b>\n<code>" + cleanId + "</code>\n\n" +57    "<i>Test ke liye bot ko is channel me admin banana na bhoolein, warna message deliver nahi hoga.</i>",58    { parse_mode: "HTML" }59  );60 61} catch (err) {62  Bot.sendMessage("⚠️ Error: " + err.message);63}