455 commands2 envUpdated 7h agoCreated Aug 26, 2026
commands/wdno.js
javascript · 69 lines
1/**#command2name: wdno3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12/**#command13name: wdno14answer: 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" || ord.status === "no") { Bot.sendMessage("قابل برگشت نیست"); return; }59ord.status = "no";60await db.global.set("wd_ord_" + oid, JSON.stringify(ord));61var buyer = String(ord.uid || "");62var amt = parseInt(ord.amt) || 0;63var cur = parseInt(await db.global.get("cash_" + buyer) || 0) || 0;64await db.global.set("cash_" + buyer, cur + amt);65Bot.sendMessage("❌ برداشت #" + oid + " رد شد. پول برگشت.");66try { Api.sendMessage({ chat_id: buyer, text: "❌ برداشت رد شد. " + amt + " تومان به کیف واقعی برگشت." }); } catch (eS) {}67} catch (e) {68 Bot.sendMessage("خطا wdno");69}