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 1h agoCreated Aug 27, 2026
Back to folder

commands/_unpin.js

javascript · 172 lines

Raw
1/**#command2name: /unpin3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12// ==========================================================13// 📌 GIFT AI — /unpin14// FAST • RESPONSIVE • ADMIN ONLY15//16// • Reply to a pinned message with /unpin17// • Checks the person using /unpin is an admin18// • Unpins the replied message19// • Replies directly to the /unpin 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 pinned message with /unpin.</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 /UNPIN55// ----------------------------------------------------------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 unpin messages.</b>",107    parse_mode: "HTML",108    reply_to_message_id: request.message_id109  });110 111  return;112}113 114 115// ----------------------------------------------------------116// UNPIN MESSAGE117// ----------------------------------------------------------118 119var unpinResult =120  await Api.unpinChatMessage({121    chat_id: chatId,122    message_id: targetMessageId123  });124 125 126// ----------------------------------------------------------127// UNPIN FAILED128// ----------------------------------------------------------129 130if (131  !unpinResult ||132  !unpinResult.ok133) {134 135  var errorMessage =136    "Telegram couldn't unpin this message.";137 138  if (139    unpinResult &&140    unpinResult.description141  ) {142    errorMessage =143      unpinResult.description;144  }145 146  await Api.sendMessage({147    chat_id: chatId,148    text:149      "❌ <b>I couldn't unpin the message.</b>\n\n" +150      errorMessage +151      "\n\n" +152      "Make sure Gift is an admin with permission to pin messages.",153    parse_mode: "HTML",154    reply_to_message_id: request.message_id155  });156 157  return;158}159 160 161// ----------------------------------------------------------162// SUCCESS163// ----------------------------------------------------------164 165await Api.sendMessage({166  chat_id: chatId,167  text:168    "📌 <b>Message unpinned.</b>\n\n" +169    "There. The message is free now. 😭💜",170  parse_mode: "HTML",171  reply_to_message_id: request.message_id172});