pnxh2371/Ankit_mods_store_botPublic · Bot Template

ProfileTelegram

AI𝐀ɴᴋɪᴛ 𝐌ᴏᴅꜱ 𝐒ᴛᴏʀᴇ 🛍 appears to be a Telegram automation bot. Commands include /*, /addbal, /addbal_all, /addbal_binance, /addbal_binance_approve, /addbal_binance_paid, /addbal_upi, /addcat_id. Observed in code: messaging, http, libs, keyboards, payments.

Utilityutility
133 commands0 envUpdated 7h agoCreated Sep 10, 2026
Back to folder

commands/_addbal_binance_approve.js

javascript · 88 lines

Raw
1/**#command2name: /addbal_binance_approve3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12// =========================================================13// ✅ ADMIN — "Approve & Credit" button on a Binance submission forward.14// Same crediting logic as /addbal, triggered with one tap instead of typing.15// =========================================================16 17try {18  var adminId = Bot.getProperty("owner_id") || "6182067327";19  var requesterId = String(user.telegramid);20  var isCoAdmin0 = Bot.getProperty("co_admin_" + requesterId);21  if (requesterId !== String(adminId) && !isCoAdmin0) {22    Bot.sendMessage("❌ You are not authorized to use this.");23    return;24  }25 26  var callbackId = request ? (request.id || (request.callback_query && request.callback_query.id)) : null;27  var parts = params ? String(params).trim().split(" ") : [];28  var targetId = parts[0];29  var amount = parseFloat(parts[1]);30 31  if (!targetId || isNaN(amount) || amount <= 0) {32    if (callbackId) {33      Api.answerCallbackQuery({ callback_query_id: String(callbackId), text: "❌ Invalid data.", show_alert: true });34    }35    return;36  }37 38  // One approval button must credit the payment only once. The forwarded39  // Telegram message id is unique for that submission, so it is safe to use40  // as the idempotency key even when the admin taps the button repeatedly.41  var approvalMessageId = (request && request.message && request.message.message_id) ? String(request.message.message_id) : "";42  var approvalKey = "binance_approved_" + String(chat.chatid) + "_" + approvalMessageId;43  if (approvalMessageId && Bot.getProperty(approvalKey)) {44    if (callbackId) {45      Api.answerCallbackQuery({ callback_query_id: String(callbackId), text: "✅ Already approved." , show_alert: true });46    }47    return;48  }49 50  try {51    // Credit only the primary wallet resource. Do not also write balance<userId>,52    // because the shop sums that legacy/bonus bucket with this resource.53    Libs.ResourcesLib.anotherUserRes("balance", targetId).add(amount);54    if (approvalMessageId) Bot.setProperty(approvalKey, true, "boolean");55 56    if (request && request.message && request.message.message_id) {57      try {58        Api.editMessageCaption({59          chat_id: chat.chatid,60          message_id: request.message.message_id,61          caption: (request.message.caption || "") + "\n\n<blockquote>✅ <b>APPROVED & CREDITED</b></blockquote>",62          parse_mode: "HTML"63        });64      } catch (e) {}65    }66 67    try {68      Api.sendMessage({69        chat_id: targetId,70        text: "<blockquote>" +71          "<tg-emoji emoji-id='6192822213486321961'>🗣</tg-emoji> Admin Approved: ₹" + amount + "\n" +72          "<tg-emoji emoji-id='6266967801580231067'>💎</tg-emoji> Balance Credited!\n" +73          "<tg-emoji emoji-id='5866053971960929280'>🛒</tg-emoji> /start TO SHOP NOW" +74          "</blockquote>",75        parse_mode: "HTML"76      });77    } catch (notifyErr) {}78 79    if (callbackId) {80      Api.answerCallbackQuery({ callback_query_id: String(callbackId), text: "✅ Credited ₹" + amount + " to " + targetId });81    }82  } catch (addbalErr) {83    Bot.sendMessage("⚠️ Error: " + addbalErr.message);84  }85 86} catch (err) {87  Bot.sendMessage("⚠️ System Error: " + err.message);88}