455 commands2 envUpdated 7h agoCreated Aug 26, 2026
commands/rpt.js
javascript · 50 lines
1/**#command2name: rpt3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12/**#command13name: rpt14answer: 15keyboard: 16parse_mode: markdown17aliases: 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 raw = "";31if (typeof params !== "undefined" && params) raw = String(params).trim();32var sp = raw.indexOf(" ");33var tid = "";34var why = "";35if (sp > 0) { tid = raw.slice(0, sp).replace(/[^0-9]/g, ""); why = raw.slice(sp + 1).trim(); }36else tid = raw.replace(/[^0-9]/g, "");37if (!tid || !why) { Bot.sendMessage("گزارش:\n/rpt آیدی دلیل"); return; }38if (tid === uid) { Bot.sendMessage("خودت را گزارش نکن."); return; }39why = why.slice(0, 400);40var box = [];41try { box = JSON.parse(String((await db.global.get("rpt_box")) || "[]")); } catch (eB) { box = []; }42if (!box || typeof box.length !== "number") box = [];43box.push({ u: uid, t: tid, w: why, n: Date.now() });44if (box.length > 40) box = box.slice(box.length - 40);45await db.global.set("rpt_box", JSON.stringify(box));46Bot.sendMessage("✅ گزارش ثبت شد.");47try { Api.sendMessage({ chat_id: "5861439682", text: "🚩 گزارش\nاز: " + uid + "\nعلیه: " + tid + "\n" + why }); } catch (eN) {}48} catch (e) {49 Bot.sendMessage("خطا rpt");50}