455 commands2 envUpdated 7h agoCreated Aug 26, 2026
commands/todin.js
javascript · 68 lines
1/**#command2name: todin3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12/**#command13name: todin14answer: 15keyboard: 16parse_mode: 17aliases: 18allow_only_group: false19need_reply: false20is_web: 021#command**/22 23try {24var uid = "";25if (typeof user !== "undefined" && user) {26 if (user.telegramid) uid = String(user.telegramid);27 else if (user.id) uid = String(user.id);28}29if (!uid) return;30var text = "";31if (typeof params !== "undefined" && params) text = String(params).trim();32if (!text && typeof message !== "undefined" && message) {33 if (typeof message === "object") text = String(message.text || message.caption || "");34 else text = String(message);35}36text = String(text || "").trim();37if (text === "لغو" || text === "🔴 لغو") {38 await db.global.set("await_tod_" + uid, "");39 Bot.sendMessage("لغو شد");40 return;41}42if (!text) {43 Bot.sendMessage("جواب را بنویس.");44 return;45}46await db.global.set("await_tod_" + uid, "");47var q = String((await db.global.get("tod_q_" + uid)) || "");48var to1 = String((await db.global.get("tod_host_" + uid)) || "");49var to2 = String((await db.global.get("tod_peer_" + uid)) || "");50var nm = "دوست";51try { if (user && user.first_name) nm = String(user.first_name); } catch (eN) {}52var body =53 "🎭 جواب حقیقت یا جرات\nاز: " + nm + "\n───────────────\n";54if (q) body = body + "سوال:\n" + q + "\n\n";55body = body + "جواب:\n" + text.slice(0, 1000);56var sent = 0;57if (to1 && to1 !== uid) {58 try { Api.sendMessage({ chat_id: to1, text: body }); sent = sent + 1; } catch (e1) {}59}60if (to2 && to2 !== uid && to2 !== to1) {61 try { Api.sendMessage({ chat_id: to2, text: body }); sent = sent + 1; } catch (e2) {}62}63if (sent < 1) {64 Bot.sendMessage("جواب ثبت شد، ولی کسی روی لینک تو نیست.\nلینک را از منوی حقیقت یا جرات بفرست.");65 return;66}67Bot.sendMessage("✅ جواب برای دوستت ارسال شد.");68} catch (e) { Bot.sendMessage("خطا todin"); }