455 commands2 envUpdated 6h agoCreated Aug 26, 2026
commands/wdok.js
javascript · 65 lines
1/**#command2name: wdok3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12/**#command13name: wdok14answer: 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 msgTxt = String(cm.text || cm.caption || "");38 }39} catch (eT) {}40var oid = "";41var hx = msgTxt.indexOf("#");42if (hx >= 0) {43 oid = msgTxt.slice(hx + 1);44 var cut = oid.length;45 var i = 0;46 for (i = 0; i < oid.length; i++) {47 var ch = oid.charAt(i);48 if (ch < "0" || ch > "9") { cut = i; break; }49 }50 oid = oid.slice(0, cut);51}52if (!oid) oid = String((await db.global.get("wd_last")) || "");53if (!oid) { Bot.sendMessage("شماره نیست"); return; }54var raw = await db.global.get("wd_ord_" + oid);55if (!raw) { Bot.sendMessage("نیست"); return; }56var ord = null;57try { ord = JSON.parse(String(raw)); } catch (eJ) { ord = null; }58if (!ord || ord.status === "ok") { Bot.sendMessage("تکراری"); return; }59ord.status = "ok";60await db.global.set("wd_ord_" + oid, JSON.stringify(ord));61Bot.sendMessage("✅ برداشت #" + oid + " واریز شد.");62try { Api.sendMessage({ chat_id: String(ord.uid), text: "✅ برداشت #" + oid + " واریز شد: " + ord.amt + " تومان" }); } catch (eS) {}63} catch (e) {64 Bot.sendMessage("خطا wdok");65}