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

javascript · 59 lines

Raw
1/**#command2name: /set_refer_earn3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12// =========================================================13// 🔧 ADMIN — Configure the Refer & Earn bonus amounts14// Usage: /set_refer_earn 2|2   (topup_bonus|buy_bonus)15// =========================================================16 17try {18  var adminId = Bot.getProperty("owner_id") || "8477746023";19  var isCoAdmin0 = Bot.getProperty("co_admin_" + String(chat.chatid));20  if (String(chat.chatid) !== adminId && !isCoAdmin0) {21    Bot.sendMessage("❌ You are not the admin!");22    return;23  }24 25  if (!params || params.trim() === "" || params.indexOf("|") === -1) {26    var topupAmt = Bot.getProperty("refer_earn_topup_amount");27    if (topupAmt === undefined || topupAmt === null) topupAmt = "2 (default)";28    var buyAmt = Bot.getProperty("refer_earn_buy_amount");29    if (buyAmt === undefined || buyAmt === null) buyAmt = "2 (default)";30    Bot.sendMessage(31      "⚠️ <b>Format:</b> <code>/set_refer_earn 2|2</code> (topup_bonus|buy_bonus)\n\n" +32      "<b>Current:</b> Topup ₹" + topupAmt + " | Buy ₹" + buyAmt,33      { parse_mode: "HTML" }34    );35    return;36  }37 38  var parts = params.trim().split("|");39  var newTopup = Number(parts[0]);40  var newBuy = Number(parts[1]);41 42  if (isNaN(newTopup) || newTopup < 0 || isNaN(newBuy) || newBuy < 0) {43    Bot.sendMessage("❌ Invalid amount! Format: <code>2|2</code>", { parse_mode: "HTML" });44    return;45  }46 47  Bot.setProperty("refer_earn_topup_amount", newTopup, "number");48  Bot.setProperty("refer_earn_buy_amount", newBuy, "number");49 50  Bot.sendMessage(51    "✅ <b>Refer & Earn amounts update ho gaye:</b>\n" +52    "• Balance-Add Bonus: ₹" + newTopup.toFixed(2) + "\n" +53    "• Purchase Bonus: ₹" + newBuy.toFixed(2),54    { parse_mode: "HTML" }55  );56 57} catch (err) {58  Bot.sendMessage("⚠️ Error: " + err.message);59}