455 commands2 envUpdated 6h agoCreated Aug 26, 2026
commands/cffgo.js
javascript · 81 lines
1/**#command2name: cffgo3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12/**#command13name: cffgo14answer: 15keyboard: 16parse_mode: 17aliases: 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");32var already = String((await db.global.get("cff_sent")) || "0") === "1";33if (already && !isAdmin) return;34var list = [];35try { list = JSON.parse(String((await db.global.get("cff_list")) || "[]")); } catch (eL) { list = []; }36if (!list || typeof list.length !== "number") list = [];37var pay = String((await db.global.get("cff_pay")) || "");38var fid = String((await db.global.get("cff_qr")) || "");39var kind = String((await db.global.get("cff_kind")) || "none");40if (!pay && !fid) {41 if (isAdmin) Bot.sendMessage("هنوز آیدی / لینک / QR نگذاشتی.");42 return;43}44if (list.length < 1) {45 if (isAdmin) Bot.sendMessage("کسی ثبتنام نکرده. برای کسی هم ارسال نمیشود.");46 return;47}48await db.global.set("cff_st", "play");49await db.global.set("cff_sent", "1");50await db.global.set("cff_play_at", Date.now());51var title = String((await db.global.get("cff_title")) || "کاستوم");52var txt = "▶️ " + title + "\nمخصوص ثبتنامشدهها\n";53if (pay) {54 if (kind === "id") txt = txt + "آیدی کاستوم:\n" + pay;55 else txt = txt + "لینک / کد:\n" + pay;56} else txt = txt + "QR را اسکن کن و وارد شو.";57var i = 0;58var ok = 0;59var fail = 0;60for (i = 0; i < list.length; i++) {61 if (!list[i] || !list[i].uid) { fail = fail + 1; continue; }62 var to = String(list[i].uid);63 if (!to) { fail = fail + 1; continue; }64 var one = false;65 if (fid) {66 try {67 Api.sendPhoto({ chat_id: to, photo: fid, caption: txt.slice(0, 1000) });68 one = true;69 } catch (eP) {}70 }71 try {72 Api.sendMessage({ chat_id: to, text: txt });73 one = true;74 } catch (eM) {}75 if (one) ok = ok + 1;76 else fail = fail + 1;77}78if (isAdmin) {79 Bot.sendMessage("ارسال فقط برای ثبتنامشدهها\n✅ " + ok + " نفر از " + list.length + " نفر لیست\nثبتنامنکرده هیچی نگرفت." + (fail ? ("\nنرسید: " + fail) : ""));80}81} catch (e) { Bot.sendMessage("خطا cffgo"); }