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

javascript Β· 105 lines

Raw
1/**#command2name: /confirm_delete_stock3answer: 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 53try {54  var ADMIN_ID = "7839151435";55  if (String(user.telegramid) !== ADMIN_ID) return;56 57  if (!params) return;58  var catSlug = params.trim().toLowerCase();59 60  var categories = Bot.getProperty("ff_categories") || {};61  62  // Stock data clean logic dono references se63  var oldStock = categories[catSlug] && categories[catSlug].stock_list ? categories[catSlug].stock_list : (Bot.getProperty("ff_stock_" + catSlug) || []);64  var totalRemoved = Array.isArray(oldStock) ? oldStock.length : 0;65 66  // 1. Clear from separate property67  Bot.setProperty("ff_stock_" + catSlug, [], "json");68 69  // 2. Clear inside ff_categories property (if exists)70  if (categories[catSlug]) {71    categories[catSlug].stock_list = [];72    Bot.setProperty("ff_categories", categories, "json");73  }74 75  // Purane confirmation message ko edit karke success message dikhana76  var queryId = request.id || (request.callback_query && request.callback_query.id);77  78  var successText = "<blockquote><tg-emoji emoji-id='6267140231632262769'>✨</tg-emoji> <b>STOCK PURGED SUCCESSFULLY</b></blockquote>\n" +79                    "━━━━━━━━━━━━━━━━━━━━━━━━━━\n\n" +80                    "πŸ“‚ <b>Category Slug:</b> <code>" + catSlug.toUpperCase() + "</code>\n" +81                    "πŸ—‘ <b>Removed Count:</b> <code>" + totalRemoved + " Items</code>\n\n" +82                    "━━━━━━━━━━━━━━━━━━━━━━━━━━\n" +83                    "βœ… <i>All stock has been permanently wiped from the database.</i>";84 85  HTTP.post({86    url: "https://api.telegram.org/bot" + bot.token + "/editMessageText",87    body: {88      chat_id: chat.chatid,89      message_id: request.message.message_id,90      text: successText,91      parse_mode: "HTML"92    }93  });94 95  if (queryId) {96    Api.answerCallbackQuery({97      callback_query_id: String(queryId),98      text: "πŸ—‘οΈ Stock cleared completely!",99      show_alert: false100    });101  }102 103} catch (e) {104  Bot.sendMessage("Delete Callback Error: " + e.message);105}