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/_tagall.js

javascript · 115 lines

Raw
1/**#command2name: /tagall3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12// ==========================================13// /tagall14// ==========================================15 16if (!isGroupChatNow()) {17  return;18}19 20 21if (!(await callerIsAdmin())) {22 23  await Api.sendMessage({24    text:25      "⛔ Only administrators can use /tagall."26  });27 28  return;29}30 31 32let list =33  await db.bot.get(34    "participants:" + String(chat.id),35    []36  );37 38 39if (!Array.isArray(list) || !list.length) {40 41  await Api.sendMessage({42    text:43      "👥 I haven't seen enough members yet to build the tag list."44  });45 46  return;47}48 49 50// Avoid huge Telegram messages.51let usable =52  list.slice(-60);53 54 55let mentions = [];56 57 58for (let i = 0; i < usable.length; i++) {59 60  if (61    usable[i] &&62    usable[i].id63  ) {64 65    mentions.push(66      mentionHTML(usable[i])67    );68  }69}70 71 72let header =73  "📣 Calling the members I've seen in this group:\n\n";74 75 76let current =77  header;78 79 80for (81  let i = 0;82  i < mentions.length;83  i++84) {85 86  let item =87    mentions[i] + " ";88 89  if (90    current.length +91    item.length >92    390093  ) {94 95    await Api.sendMessage({96      text: current,97      parse_mode: "HTML"98    });99 100    current = item;101 102  } else {103 104    current += item;105  }106}107 108 109if (current.trim()) {110 111  await Api.sendMessage({112    text: current,113    parse_mode: "HTML"114  });115  }