tarunpoonia905/OfcDevShopBotPublic ยท Bot Template

ProfileTelegram

AIDEV SHOP appears to be a Telegram automation bot. Commands include /confirm_delete_stock, /addstock_id, /extkey_menu, /partner_api, /apidelete, /buy_hack_cat, /admin_manage_products, /check_buy. Observed in code: messaging, keyboards, payments, libs, web, http, games.

Utilityutility
228 commands0 envUpdated 12d agoCreated Oct 18, 2026
Back to folder

commands/_allbal.js

javascript ยท 100 lines

Raw
1/**#command2name: /allbal3answer: 4keyboard: 5parse_mode: html6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12// =========================================================13// ๐Ÿ‘ฅ /allbal โ€” All Users Balance (Admin)14// Bot ke sabhi users: Name, @Username, User ID, Balance, Total Spent.15// Page-wise (15 users per page) taaki message limit na toote.16// =========================================================17try {18  var adminId = String(Bot.getProperty("owner_id") || "7127818616");19  var requesterId = String(user.telegramid);20  var isCoAdmin = Bot.getProperty("co_admin_" + requesterId);21 22  if ((requesterId !== adminId && !Bot.getProperty("co_admin_" + String(requesterId))) && !isCoAdmin) {23    Bot.sendMessage("โŒ Access Denied.");24    return;25  }26 27  if (request && request.id) {28    try { Api.answerCallbackQuery({ callback_query_id: request.id }); } catch (__a1) {}29  }30 31  function esc(v) {32    return String(v == null ? "" : v).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");33  }34 35  // page number: "/allbal 2", "/allbal page=2" ya params object36  var page = 1;37  try {38    var rawP = (typeof params !== "undefined" && params !== null) ? params : "";39    if (typeof rawP === "object" && rawP.page) rawP = rawP.page;40    var mm = String(rawP).match(/(\d+)/);41    if (mm) page = parseInt(mm[1], 10);42  } catch (pe) {}43  if (!isFinite(page) || page < 1) page = 1;44 45  var userList = Bot.getProperty("all_users_list") || [];46  if (!Array.isArray(userList)) userList = [];47  if (userList.length === 0) {48    Bot.sendMessage("โš ๏ธ <b>Database Empty:</b> Abhi tak koi user register nahi hua.", { parse_mode: "HTML" });49    return;50  }51 52  var perPage = 15;53  var totalPages = Math.ceil(userList.length / perPage);54  if (page > totalPages) page = totalPages;55  var start = (page - 1) * perPage;56  var slice = userList.slice(start, start + perPage);57 58  function getBal(uid) {59    var b = 0;60    try { b = Number(Libs.ResourcesLib.anotherUserRes("balance", uid).value()) || 0; } catch (e1) {}61    var legacy = Number(Bot.getProperty("balance" + uid) || 0) || 0;62    return b + legacy;63  }64 65  var text = "<blockquote><b>๐Ÿ‘ฅ ALL USERS BALANCE</b>\n\n" +66             "๐Ÿ“Š <b>Total Users:</b> <code>" + userList.length + "</code>\n" +67             "๐Ÿ“„ <b>Page:</b> <code>" + page + " / " + totalPages + "</code></blockquote>\n" +68             "โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”\n\n";69 70  for (var i = 0; i < slice.length; i++) {71    var uid = String(slice[i]);72    var prof = Bot.getProperty("user_profile_" + uid) || {};73    var fullName = ((prof.first_name || "") + (prof.last_name ? " " + prof.last_name : "")).trim() || "N/A";74    var uname = prof.username ? "@" + String(prof.username).replace(/^@/, "") : "N/A";75    var bal = getBal(uid).toFixed(2);76    var spent = Number(Bot.getProperty("total_spent_by_" + uid) || 0).toFixed(2);77 78    text += "<b>[" + (start + i + 1) + "]</b> " + esc(fullName) + "\n" +79            "โ€ข <b>Username:</b> " + esc(uname) + "\n" +80            "โ€ข <b>ID:</b> <code>" + esc(uid) + "</code>\n" +81            "โ€ข <b>Balance:</b> <code>โ‚น" + bal + "</code>   <b>Spent:</b> <code>โ‚น" + spent + "</code>\n\n";82  }83 84  var nav = [];85  if (page > 1) nav.push({ text: "โฌ…๏ธ Previous", callback_data: "/allbal " + (page - 1), style: "primary" });86  if (page < totalPages) nav.push({ text: "Next โžก๏ธ", callback_data: "/allbal " + (page + 1), style: "primary" });87  var kb = [];88  if (nav.length) kb.push(nav);89  kb.push([{ text: "Back to Admin", callback_data: "/admin", style: "danger" }]);90 91  Api.sendMessage({92    chat_id: chat.chatid,93    text: text,94    parse_mode: "HTML",95    reply_markup: JSON.stringify({ inline_keyboard: kb })96  });97 98} catch (err) {99  Bot.sendMessage("โš ๏ธ <b>All Balance Error:</b> <code>" + String(err.message).replace(/</g, "&lt;") + "</code>", { parse_mode: "HTML" });100}
commands/_allbal.js ยท tarunpoonia905/OfcDevShopBot ยท TeleDevs