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

javascript · 218 lines

Raw
1/**#command2name: /unban3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12// ==========================================================13// 👑 GIFT AI — /unban14// FAST • RESPONSIVE • ADMIN ONLY15//16// • Reply to the user's message with /unban17// • Checks the command user is an admin18// • Gets target ID from the replied message19// • Directly unbans the target20// • Replies directly to the /unban command21// ==========================================================22 23 24// ----------------------------------------------------------25// REQUIRE REPLY26// ----------------------------------------------------------27 28if (29  !request ||30  !request.reply_to_message ||31  !request.reply_to_message.from32) {33 34  await Api.sendMessage({35    chat_id: chat.id,36    text:37      "⚠️ <b>Reply to the user's message with /unban</b>",38    parse_mode: "HTML",39    reply_to_message_id: request ? request.message_id : undefined40  });41 42  return;43}44 45 46// ----------------------------------------------------------47// GET CHAT + USERS48// ----------------------------------------------------------49 50var chatId = chat.id;51var adminId = request.from.id;52var target = request.reply_to_message.from;53 54 55if (!target || !target.id) {56 57  await Api.sendMessage({58    chat_id: chatId,59    text:60      "⚠️ <b>I couldn't identify that user.</b>",61    parse_mode: "HTML",62    reply_to_message_id: request.message_id63  });64 65  return;66}67 68 69var targetId = target.id;70 71 72// ----------------------------------------------------------73// GET NAMES74// ----------------------------------------------------------75 76var adminName = String(77  request.from.first_name ||78  request.from.username ||79  "Admin"80);81 82var targetName = String(83  target.first_name ||84  target.username ||85  "User"86);87 88if (target.last_name) {89  targetName += " " + String(target.last_name);90}91 92 93// ----------------------------------------------------------94// PREVENT SELF UNBAN95// ----------------------------------------------------------96 97if (String(adminId) === String(targetId)) {98 99  await Api.sendMessage({100    chat_id: chatId,101    text:102      "😐 <b>You don't need to unban yourself.</b>",103    parse_mode: "HTML",104    reply_to_message_id: request.message_id105  });106 107  return;108}109 110 111// ----------------------------------------------------------112// CHECK ADMIN113// ----------------------------------------------------------114 115var adminCheck = await Api.getChatMember({116  chat_id: chatId,117  user_id: adminId118});119 120 121if (122  !adminCheck ||123  !adminCheck.ok ||124  !adminCheck.result125) {126 127  await Api.sendMessage({128    chat_id: chatId,129    text:130      "⚠️ <b>I couldn't verify your admin status.</b>",131    parse_mode: "HTML",132    reply_to_message_id: request.message_id133  });134 135  return;136}137 138 139// ----------------------------------------------------------140// VERIFY ADMIN STATUS141// ----------------------------------------------------------142 143var adminStatus = adminCheck.result.status;144 145 146if (147  adminStatus !== "administrator" &&148  adminStatus !== "creator"149) {150 151  await Api.sendMessage({152    chat_id: chatId,153    text:154      "🚫 <b>Only group admins can use /unban.</b>",155    parse_mode: "HTML",156    reply_to_message_id: request.message_id157  });158 159  return;160}161 162 163// ----------------------------------------------------------164// UNBAN DIRECTLY165// ----------------------------------------------------------166 167var unbanResult = await Api.unbanChatMember({168  chat_id: chatId,169  user_id: targetId,170  only_if_banned: true171});172 173 174// ----------------------------------------------------------175// CHECK RESULT176// ----------------------------------------------------------177 178if (179  !unbanResult ||180  !unbanResult.ok181) {182 183  await Api.sendMessage({184    chat_id: chatId,185    text:186      "❌ <b>I couldn't unban " +187      targetName +188      ".</b>\n\n" +189      "Make sure:\n" +190      "• Gift is an admin\n" +191      "• Gift has ban/restrict members permission\n" +192      "• The user is actually banned",193    parse_mode: "HTML",194    reply_to_message_id: request.message_id195  });196 197  return;198}199 200 201// ----------------------------------------------------------202// SUCCESS203// ----------------------------------------------------------204 205await Api.sendMessage({206  chat_id: chatId,207  text:208    "🔓 <b>" +209    targetName +210    "</b> has been unbanned.\n\n" +211    "👑 Admin: <a href=\"tg://user?id=" +212    adminId +213    "\">" +214    adminName +215    "</a>",216  parse_mode: "HTML",217  reply_to_message_id: request.message_id218});