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

javascript · 361 lines

Raw
1/**#command2name: /tagall3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12// ==========================================================13// 💜 GIFT AI — /TAGALL14// TELEBOTHOST15//16// • ADMIN ONLY17// • DIRECTLY REPLIES TO /tagall18// • TAGS SAVED MEMBERS19// • DOES NOT ONLY TAG THE COMMAND USER20// • DUPLICATE SAFE21// ==========================================================22 23 24// ----------------------------------------------------------25// 1. CHECK GROUP26// ----------------------------------------------------------27 28if (29  !chat ||30  (chat.type !== "group" && chat.type !== "supergroup")31) {32  return;33}34 35 36// ----------------------------------------------------------37// 2. CHECK USER38// ----------------------------------------------------------39 40if (!user || !user.id) {41  return;42}43 44 45// ----------------------------------------------------------46// 3. GET THE ORIGINAL /TAGALL MESSAGE ID47// ----------------------------------------------------------48 49var commandMessageId = null;50 51 52// TeleBotHost / Telegram update53if (54  typeof request !== "undefined" &&55  request &&56  request.message_id57) {58  commandMessageId = request.message_id;59}60 61 62// Standard message object63if (64  !commandMessageId &&65  typeof message !== "undefined" &&66  message &&67  message.message_id68) {69  commandMessageId = message.message_id;70}71 72 73// Telegram message inside request74if (75  !commandMessageId &&76  typeof request !== "undefined" &&77  request &&78  request.message &&79  request.message.message_id80) {81  commandMessageId =82    request.message.message_id;83}84 85 86// ----------------------------------------------------------87// 4. CHECK ADMIN88// ----------------------------------------------------------89 90var adminCheck;91 92try {93 94  adminCheck = await Api.call("getChatMember", {95    chat_id: chat.id,96    user_id: user.id97  });98 99} catch (e) {100 101  var errorOptions = {102    chat_id: chat.id,103    text: "💀 Couldn't verify your admin status. Try again."104  };105 106  if (commandMessageId) {107    errorOptions.reply_to_message_id =108      commandMessageId;109  }110 111  await Api.sendMessage(errorOptions);112  return;113}114 115 116// ----------------------------------------------------------117// 5. VERIFY ADMIN RESPONSE118// ----------------------------------------------------------119 120if (121  !adminCheck ||122  !adminCheck.ok ||123  !adminCheck.result124) {125 126  var verifyOptions = {127    chat_id: chat.id,128    text: "💀 Telegram couldn't verify your admin status."129  };130 131  if (commandMessageId) {132    verifyOptions.reply_to_message_id =133      commandMessageId;134  }135 136  await Api.sendMessage(verifyOptions);137  return;138}139 140 141// ----------------------------------------------------------142// 6. ADMIN ONLY143// ----------------------------------------------------------144 145var status = adminCheck.result.status;146 147if (148  status !== "administrator" &&149  status !== "creator"150) {151 152  var deniedOptions = {153    chat_id: chat.id,154    text: "💀 Cute attempt. Only admins can use /tagall."155  };156 157  if (commandMessageId) {158    deniedOptions.reply_to_message_id =159      commandMessageId;160  }161 162  await Api.sendMessage(deniedOptions);163  return;164}165 166 167// ----------------------------------------------------------168// 7. LOAD SAVED MEMBERS169// ----------------------------------------------------------170 171var key =172  "TAGALL_MEMBERS_" + chat.id;173 174var savedMembers = [];175 176try {177 178  var data =179    await db.bot.get(key, []);180 181  if (Array.isArray(data)) {182    savedMembers = data;183  }184 185} catch (e) {186 187  savedMembers = [];188}189 190 191// ----------------------------------------------------------192// 8. REMOVE DUPLICATES193// ----------------------------------------------------------194 195var members = [];196var seen = {};197 198for (var i = 0; i < savedMembers.length; i++) {199 200  var member = savedMembers[i];201 202  if (!member || !member.id) {203    continue;204  }205 206  var id = String(member.id);207 208  if (seen[id]) {209    continue;210  }211 212  seen[id] = true;213  members.push(member);214}215 216 217// ----------------------------------------------------------218// 9. NO MEMBERS219// ----------------------------------------------------------220 221if (members.length === 0) {222 223  var noneOptions = {224    chat_id: chat.id,225    text:226      "💀 Nobody is saved yet.\n\n" +227      "Let people talk in the group first."228  };229 230  if (commandMessageId) {231    noneOptions.reply_to_message_id =232      commandMessageId;233  }234 235  await Api.sendMessage(noneOptions);236  return;237}238 239 240// ----------------------------------------------------------241// 10. BUILD TAGS242// ----------------------------------------------------------243 244var chunks = [];245var current =246  "💜 <b>EVERYBODY WAKE UP.</b>\n\n";247 248var tagged = 0;249 250 251for (var j = 0; j < members.length; j++) {252 253  var m = members[j];254 255  if (!m || !m.id) {256    continue;257  }258 259 260  var name =261    m.first_name ||262    m.username ||263    "User";264 265 266  name = String(name)267    .replace(/&/g, "&amp;")268    .replace(/</g, "&lt;")269    .replace(/>/g, "&gt;");270 271 272  var mention =273    '<a href="tg://user?id=' +274    String(m.id) +275    '">' +276    name +277    "</a> ";278 279 280  if (281    (current + mention).length > 3800282  ) {283 284    chunks.push(current);285 286    current =287      "💜 <b>STILL NOT DONE.</b>\n\n";288  }289 290 291  current += mention;292  tagged++;293}294 295 296// ----------------------------------------------------------297// 11. PUSH LAST CHUNK298// ----------------------------------------------------------299 300if (current.trim() !== "") {301  chunks.push(current);302}303 304 305// ----------------------------------------------------------306// 12. SEND TAGS307// ----------------------------------------------------------308 309for (var x = 0; x < chunks.length; x++) {310 311  var options = {312    chat_id: chat.id,313    text: chunks[x],314    parse_mode: "HTML",315    disable_web_page_preview: true316  };317 318 319  // THIS IS THE IMPORTANT PART320  // FIRST RESPONSE = DIRECT REPLY TO /TAGALL321 322  if (323    x === 0 &&324    commandMessageId325  ) {326 327    options.reply_to_message_id =328      Number(commandMessageId);329  }330 331 332  await Api.sendMessage(options);333}334 335 336// ----------------------------------------------------------337// 13. FINAL DIRECT REPLY338// ----------------------------------------------------------339 340var finalOptions = {341  chat_id: chat.id,342  text:343    "💜 <b>Done.</b>\n\n" +344    "👥 Tagged: <b>" +345    tagged +346    "</b>\n\n" +347    "🙄 There. Everybody has been disturbed.\n" +348    "Happy now, boss?",349  parse_mode: "HTML"350};351 352 353// Always reply to the original /tagall354if (commandMessageId) {355 356  finalOptions.reply_to_message_id =357    Number(commandMessageId);358}359 360 361await Api.sendMessage(finalOptions);