455 commands2 envUpdated 6h agoCreated Aug 26, 2026
commands/msnok.js
javascript · 71 lines
1/**#command2name: msnok3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12/**#command13name: msnok14answer: 15keyboard: 16parse_mode: markdown17aliases: 18allow_only_group: false19need_reply: false20is_web: 021#command**/22 23try {24try { Api.answerCallbackQuery({ text: "مأموریت تایید شد" }); } catch (e0) {}25var uid = "";26if (typeof user !== "undefined" && user) {27 if (user.telegramid) uid = String(user.telegramid);28 else if (user.id) uid = String(user.id);29}30var isBoss = (uid === "5861439682");31var isAdmin = isBoss || ((await db.global.get("rank_" + uid)) === "admin");32if (!isAdmin) { Bot.sendMessage("فقط ادمین"); return; }33var msgTxt = "";34try {35 if (typeof update !== "undefined" && update && update.callback_query && update.callback_query.message) {36 var cm = update.callback_query.message;37 if (cm.caption) msgTxt = String(cm.caption);38 else if (cm.text) msgTxt = String(cm.text);39 }40} catch (eT) {}41var oid = "";42var hx = msgTxt.indexOf("#");43if (hx >= 0) {44 oid = msgTxt.slice(hx + 1);45 var cut = oid.length;46 var i = 0;47 for (i = 0; i < oid.length; i++) {48 var ch = oid.charAt(i);49 if (ch < "0" || ch > "9") { cut = i; break; }50 }51 oid = oid.slice(0, cut);52}53if (!oid) oid = String((await db.global.get("msn_last")) || "");54if (!oid) { Bot.sendMessage("شماره مأموریت نیست"); return; }55var raw = await db.global.get("msn_ord_" + oid);56if (!raw) { Bot.sendMessage("سفارش نیست"); return; }57var ord = null;58try { ord = JSON.parse(String(raw)); } catch (eJ) { ord = null; }59if (!ord || ord.status === "ok") { Bot.sendMessage("نامعتبر یا تکراری"); return; }60ord.status = "ok";61await db.global.set("msn_ord_" + oid, JSON.stringify(ord));62var buyer = String(ord.uid || "");63var pay = parseInt(ord.pay) || 0;64var cur = parseInt(await db.global.get("cash_" + buyer) || 0) || 0;65await db.global.set("cash_" + buyer, cur + pay);66var tit = String(ord.title || "مأموریت");67Bot.sendMessage("✅ تایید شد: " + tit + "\nاسکرین #" + oid + "\n+" + pay + " تومان واقعی");68try { Api.sendMessage({ chat_id: buyer, text: "✅ مأموریت تایید شد:\n" + tit + "\n+" + pay + " تومان به کیف واقعی." }); } catch (eS) {}69} catch (e) {70 Bot.sendMessage("خطا msnok");71}