millswelbeck148/SireimadeBotPublic · Bot Template

AISireImade appears to be a Telegram automation bot. Commands include /start, /about, /support, /id, /admin, /ban, /unban, /x. Observed in code: messaging, keyboards, games.

Utilityutility
ProfileTelegram
112 commands3 envUpdated 2h agoCreated Aug 27, 2026
Back to folder

commands/_warnings.js

javascript · 193 lines

Raw
1/**#command2name: /warnings3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12// ==========================================================13// 💜 GIFT AI — /WARNINGS14// ADMIN-ONLY WARNING RECORD15//16// • Must reply to a member's message17// • Accurate admin verification18// • Shows warnings for that member19// • Replies directly to /warnings20// • Fast + error-safe21// ==========================================================22 23 24// ----------------------------------------------------------25// 📌 GROUP ONLY26// ----------------------------------------------------------27 28if (29  !chat ||30  (chat.type !== "group" && chat.type !== "supergroup")31) {32  Api.sendMessage({33    chat_id: chat.id,34    text: "⚠️ This command only works in groups."35  });36  return;37}38 39 40// ----------------------------------------------------------41// 📌 MUST REPLY TO A MESSAGE42// ----------------------------------------------------------43 44if (!request.reply_to_message) {45  Api.sendMessage({46    chat_id: chat.id,47    text: "⚠️ Reply to a member's message with /warnings.",48    reply_to_message_id: request.message_id49  });50  return;51}52 53 54// ----------------------------------------------------------55// 👤 GET USERS56// ----------------------------------------------------------57 58var adminId = request.from.id;59var target = request.reply_to_message.from;60 61if (!target || !target.id) {62  Api.sendMessage({63    chat_id: chat.id,64    text: "❌ I couldn't identify that member.",65    reply_to_message_id: request.message_id66  });67  return;68}69 70var targetId = target.id;71 72 73// ----------------------------------------------------------74// 🔐 VERIFY ADMIN75// ----------------------------------------------------------76 77var adminCheck;78 79try {80 81  adminCheck = await Api.call("getChatMember", {82    chat_id: chat.id,83    user_id: adminId84  });85 86} catch (e) {87 88  Api.sendMessage({89    chat_id: chat.id,90    text: "⚠️ I couldn't verify your admin status.",91    reply_to_message_id: request.message_id92  });93 94  return;95}96 97 98// ----------------------------------------------------------99// ❌ API CHECK FAILED100// ----------------------------------------------------------101 102if (103  !adminCheck ||104  !adminCheck.ok ||105  !adminCheck.result106) {107  Api.sendMessage({108    chat_id: chat.id,109    text: "⚠️ I couldn't verify your admin status.",110    reply_to_message_id: request.message_id111  });112 113  return;114}115 116 117// ----------------------------------------------------------118// 👑 ADMIN / OWNER ONLY119// ----------------------------------------------------------120 121var adminStatus = adminCheck.result.status;122 123if (124  adminStatus !== "administrator" &&125  adminStatus !== "creator"126) {127  Api.sendMessage({128    chat_id: chat.id,129    text: "❌ You're not an admin. You can't check warnings.",130    reply_to_message_id: request.message_id131  });132 133  return;134}135 136 137// ----------------------------------------------------------138// ⚠️ GET WARNING RECORD139// ----------------------------------------------------------140 141var warnKey = "WARN_" + chat.id + "_" + targetId;142 143var warnings = Bot.getProperty(warnKey);144 145 146// ----------------------------------------------------------147// 🧮 VALIDATE WARNING COUNT148// ----------------------------------------------------------149 150if (151  typeof warnings !== "number" ||152  !isFinite(warnings) ||153  warnings < 0154) {155  warnings = 0;156}157 158 159// ----------------------------------------------------------160// 👤 SAFE USER NAME161// ----------------------------------------------------------162 163var name = target.first_name || "User";164 165name = String(name)166  .replace(/&/g, "&amp;")167  .replace(/</g, "&lt;")168  .replace(/>/g, "&gt;")169  .replace(/"/g, "&quot;");170 171 172// ----------------------------------------------------------173// 💜 SEND WARNING RECORD174// ----------------------------------------------------------175 176Api.sendMessage({177  chat_id: chat.id,178  text:179    "⚠️ <b>WARNING RECORD</b>\n\n" +180    "👤 User: <a href=\"tg://user?id=" +181    targetId +182    "\">" +183    name +184    "</a>\n" +185    "🆔 ID: <code>" +186    targetId +187    "</code>\n" +188    "⚠️ Warnings: <b>" +189    warnings +190    "</b>",191  parse_mode: "HTML",192  reply_to_message_id: request.message_id193});