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

javascript · 173 lines

Raw
1/**#command2name: /pin3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12// ==========================================================13// 📌 GIFT AI — /pin14// FAST • RESPONSIVE • ADMIN ONLY15//16// • Reply to a message with /pin17// • Checks the person using /pin is an admin18// • Pins the replied message19// • Replies directly to the /pin command20// ==========================================================21 22 23// ----------------------------------------------------------24// BASIC CHECK25// ----------------------------------------------------------26 27if (!request || !request.reply_to_message) {28 29  await Api.sendMessage({30    chat_id: chat.id,31    text:32      "📌 <b>Reply to the message you want to pin with /pin.</b>",33    parse_mode: "HTML",34    reply_to_message_id:35      request ? request.message_id : undefined36  });37 38  return;39}40 41 42// ----------------------------------------------------------43// GET DATA44// ----------------------------------------------------------45 46var chatId = chat.id;47var adminId = request.from.id;48 49var targetMessageId =50  request.reply_to_message.message_id;51 52 53// ----------------------------------------------------------54// CHECK USER WHO USED /PIN55// ----------------------------------------------------------56 57var adminCheck =58  await Api.getChatMember({59    chat_id: chatId,60    user_id: adminId61  });62 63 64// ----------------------------------------------------------65// ADMIN CHECK FAILED66// ----------------------------------------------------------67 68if (69  !adminCheck ||70  !adminCheck.ok ||71  !adminCheck.result72) {73 74  await Api.sendMessage({75    chat_id: chatId,76    text:77      "⚠️ <b>I couldn't verify your admin status.</b>",78    parse_mode: "HTML",79    reply_to_message_id: request.message_id80  });81 82  return;83}84 85 86// ----------------------------------------------------------87// ADMIN STATUS88// ----------------------------------------------------------89 90var adminStatus =91  adminCheck.result.status;92 93 94// ----------------------------------------------------------95// ONLY ADMINS96// ----------------------------------------------------------97 98if (99  adminStatus !== "administrator" &&100  adminStatus !== "creator"101) {102 103  await Api.sendMessage({104    chat_id: chatId,105    text:106      "🚫 <b>Only group admins can pin messages.</b>",107    parse_mode: "HTML",108    reply_to_message_id: request.message_id109  });110 111  return;112}113 114 115// ----------------------------------------------------------116// PIN MESSAGE117// ----------------------------------------------------------118 119var pinResult =120  await Api.pinChatMessage({121    chat_id: chatId,122    message_id: targetMessageId,123    disable_notification: false124  });125 126 127// ----------------------------------------------------------128// PIN FAILED129// ----------------------------------------------------------130 131if (132  !pinResult ||133  !pinResult.ok134) {135 136  var errorMessage =137    "Telegram couldn't pin this message.";138 139  if (140    pinResult &&141    pinResult.description142  ) {143    errorMessage =144      pinResult.description;145  }146 147  await Api.sendMessage({148    chat_id: chatId,149    text:150      "❌ <b>I couldn't pin the message.</b>\n\n" +151      errorMessage +152      "\n\n" +153      "Make sure Gift is an admin with permission to pin messages.",154    parse_mode: "HTML",155    reply_to_message_id: request.message_id156  });157 158  return;159}160 161 162// ----------------------------------------------------------163// SUCCESS164// ----------------------------------------------------------165 166await Api.sendMessage({167  chat_id: chatId,168  text:169    "📌 <b>Message pinned.</b>\n\n" +170    "There. It's pinned. Try not to unpin it five seconds later. 😭💜",171  parse_mode: "HTML",172  reply_to_message_id: request.message_id173});