adityajat/SaarvamAI_botPublic · Bot Template

ProfileTelegram

AISarvam AI is a multi‑purpose Telegram bot that lets users ask questions, get explanations, convert text to speech, and translate messages using the Sarvam AI API. It also offers group administration commands such as warn, mute, ban, pin, delete, and announcements, and can clear personal or group AI memory. The bot uses the TeleBotHost TBL framework with Bot, Api, db, and HTTP calls, and provides inline keyboards for language and voice selection.

Ai Assistantaivoicetranslatemoderationadminsarvam
34 commands4 envUpdated 15d agoCreated Sep 14, 2026
Back to folder

commands/_admin.js

javascript · 94 lines

Raw
1/**#command2name: /admin3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12// ==========================================13// /admin14// ==========================================15 16if (!update.message || !update.message.chat) {17  return;18}19 20let chat = update.message.chat;21 22if (23  chat.type !== "group" &&24  chat.type !== "supergroup"25) {26  Api.sendMessage({27    text:28      "👑 /admin is available inside groups."29  });30  return;31}32 33let isAnonymousAdmin =34  update.message.sender_chat &&35  update.message.sender_chat.id === chat.id;36 37let isAdmin = false;38 39if (!isAnonymousAdmin && update.message.from) {40 41  let member = await Api.call(42    "getChatMember",43    {44      chat_id: chat.id,45      user_id: update.message.from.id46    }47  );48 49  if (50    member.ok &&51    member.result &&52    (53      member.result.status === "administrator" ||54      member.result.status === "creator"55    )56  ) {57    isAdmin = true;58  }59}60 61if (!isAdmin && !isAnonymousAdmin) {62  Api.sendMessage({63    text: "❌ This command is for group administrators only."64  });65  return;66}67 68Api.sendMessage({69  text:70    "👑 ADMIN CONTROL PANEL\n\n" +71 72    "🛡️ MODERATION\n" +73    "/warn — Warn a member\n" +74    "/warnings — View warnings\n" +75    "/mute — Mute a member\n" +76    "/unmute — Unmute a member\n" +77    "/ban — Ban a member\n" +78    "/unban — Unban a member\n\n" +79 80    "📌 GROUP CONTROL\n" +81    "/pin — Pin replied message\n" +82    "/unpin — Unpin latest message\n" +83    "/announce <text> — Announcement\n\n" +84 85    "👥 MEMBERS\n" +86    "/tag — Tag a member\n" +87    "/tagall — Tag known active members\n\n" +88 89    "🤖 AUTOMOD\n" +90    "/automod on\n" +91    "/automod off\n\n" +92 93    "⚠️ The bot itself must have the appropriate Telegram admin permissions for ban, mute, pin and related actions."94});