indrajitghosh20006/Igstore_01botPublic Β· Bot Template

ProfileTelegram

AIThe bot provides an admin interface for a digital store, allowing the owner or co‑admins to add balances, products, plans, and categories. It supports payment workflows via UPI and Binance Pay, automatically generating QR codes and handling manual approval of deposits. The code patches inline keyboards to use premium emoji icons and includes helper functions for user and bot properties. Overall, it serves as a commerce management tool for a Telegram-based storefront.

Commercestoreadminbalanceproductplancategory
170 commands0 envUpdated 7h agoCreated Oct 30, 2026
Back to folder

commands/_addfund.js

javascript Β· 145 lines

Raw
1/**#command2name: /addfund3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12// PREMIUM BUTTON ICONS13(function(){14  try {15    if (!JSON.__premiumPatched) {16      var __origStringify = JSON.stringify;17      JSON.stringify = function(value, replacer, space) {18        try {19          if (value && value.inline_keyboard && Array.isArray(value.inline_keyboard)) {20            var premiumIds = [21              "6143444134125379822",22              "6091379307907652768",23              "6147534454819661264",24              "6147817325660741985",25              "6235683689292897318",26              "6102856637343600044"27            ];28            var rows = value.inline_keyboard.map(function(row, ri) {29              if (!Array.isArray(row)) return row;30              return row.map(function(btn, bi) {31                if (!btn || typeof btn !== "object") return btn;32                var copy = {};33                for (var k in btn) copy[k] = btn[k];34                if (!copy.icon_custom_emoji_id) copy.icon_custom_emoji_id = premiumIds[(ri + bi) % premiumIds.length];35                return copy;36              });37            });38            var cloned = {};39            for (var key in value) cloned[key] = value[key];40            cloned.inline_keyboard = rows;41            return __origStringify.call(JSON, cloned, replacer, space);42          }43        } catch (e) {}44        return __origStringify.call(JSON, value, replacer, space);45      };46      JSON.__premiumPatched = true;47    }48  } catch (e) {}49})();50 51 52 53// =========================================================54// πŸ’° COMMAND = Initial Deposit Keypad Setup55// STATUS: βœ… PREMIUM CALCULATOR UI β€” colored buttons + premium emojis56// (kept in sync with /press.js so the screen never "flickers"/changes57// style when the user presses the first digit)58// =========================================================59 60try {61  // Amount ko shuru me 0 set karein62  User.setProperty("deposit_amount", "0", "string");63 64  // πŸ’Ž Premium Emoji Set β€” user-provided premium IDs applied across this screen65  let e_money   = "<tg-emoji emoji-id='6312263493051489212'>πŸ’°</tg-emoji>";66  let e_clear   = "<tg-emoji emoji-id='5348224471050238603'>✏</tg-emoji>";67  let e_confirm = "<tg-emoji emoji-id='5348191451341668809'>βœ…</tg-emoji>";68  let e_back    = "<tg-emoji emoji-id='5893163582194978381'>⬅️</tg-emoji>";69  let e_hour    = "<tg-emoji emoji-id='6100657257605763582'>βœ”οΈ</tg-emoji>";70  let e_check   = "<tg-emoji emoji-id='6311870645277825763'>βœ”οΈ</tg-emoji>";71 72  // 🎨 Main message β€” premium "Enter Custom Amount" calculator screen73  let msg =74    "<blockquote>" + e_money + " <b>ADD BALANCE β€” ENTER AMOUNT</b> <tg-emoji emoji-id='6312263493051489212'>πŸ’Ž</tg-emoji></blockquote>\n" +75    "━━━━━━━━━━━━━━━━━━━━━\n\n" +76    "<tg-emoji emoji-id='6312263493051489212'>πŸ’Ž</tg-emoji> <b>Amount:</b> β‚Ή<code>0</code>\n\n" +77    "━━━━━━━━━━━━━━━━━━━━━\n" +78    e_check + " <i>Instant Auto-Credit</i>\n" +79    "<tg-emoji emoji-id='6215386799133433653'>πŸ”’</tg-emoji> <i>100% Secure UPI Payment</i>\n" +80    e_hour + " <i>Verified in Seconds</i>\n\n" +81    "<tg-emoji emoji-id='6100170496077204999'>πŸ‘‘</tg-emoji> <i>Use the keypad below to enter amount</i>";82 83  // 🎨 Styled keyboard payload β€” blue number pad, red clear/back, green confirm84  let keyboard = [85    [86      { text: "1", callback_data: "/press 1", style: "primary" },87      { text: "2", callback_data: "/press 2", style: "primary" },88      { text: "3", callback_data: "/press 3", style: "primary" }89    ],90    [91      { text: "4", callback_data: "/press 4", style: "primary" },92      { text: "5", callback_data: "/press 5", style: "primary" },93      { text: "6", callback_data: "/press 6", style: "primary" }94    ],95    [96      { text: "7", callback_data: "/press 7", style: "primary" },97      { text: "8", callback_data: "/press 8", style: "primary" },98      { text: "9", callback_data: "/press 9", style: "primary" }99    ],100    [101      { text: "Clear", callback_data: "/press clear", style: "danger", icon_custom_emoji_id: "5348224471050238603" },102      { text: "0", callback_data: "/press 0", style: "primary" },103      { text: "Confirm", callback_data: "/press confirm", style: "success", icon_custom_emoji_id: "5348191451341668809" }104    ],105    [106      { text: "Back", callback_data: "/back", style: "danger", icon_custom_emoji_id: "5893163582194978381" }107    ]108  ];109 110  // 'request.message' check karta hai ki kya ye kisi button click se trigger hua hai111  // βœ… BUG FIX: agar previous message ek PHOTO thi (jaise DP-attached Profile),112  // editMessageText kaam nahi karta β€” isi wajah se Profile se "Add Fund" click113  // karne par deposit screen aati hi nahi thi. Ab photo ho to delete + fresh send.114  if (request && request.message && request.message.message_id) {115    if (request.message.photo) {116      try { Api.deleteMessage({ chat_id: chat.chatid, message_id: request.message.message_id }); } catch (delErr) {}117      Api.sendMessage({118        chat_id: chat.chatid,119        text: msg,120        parse_mode: "HTML",121        reply_markup: JSON.stringify({ inline_keyboard: keyboard })122      });123    } else {124      // Alag se naya message nahi bhejega, usi menu ko edit karke keypad bana dega125      Api.editMessageText({126        chat_id: chat.chatid,127        message_id: request.message.message_id,128        text: msg,129        parse_mode: "HTML",130        reply_markup: JSON.stringify({ inline_keyboard: keyboard })131      });132    }133  } else {134    // Agar direct command run hua toh naya message bhejega safety ke liye135    Api.sendMessage({136      chat_id: chat.chatid,137      text: msg,138      parse_mode: "HTML",139      reply_markup: JSON.stringify({ inline_keyboard: keyboard })140    });141  }142 143} catch (err) {144  Bot.sendMessage("⚠️ System Error: " + err.message);145}