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

javascript · 295 lines

Raw
1/**#command2name: /unmute3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12// ==========================================================13// 👑 GIFT AI — /unmute14// FAST • RESPONSIVE • ADMIN ONLY15//16// • Reply to a user's message with /unmute17// • Checks the person using /unmute is an admin18// • Checks the target19// • Cannot unmute yourself20// • Unmutes the target completely21// • Replies directly to the /unmute message22// ==========================================================23 24 25// ----------------------------------------------------------26// BASIC CHECK27// ----------------------------------------------------------28 29if (!request || !request.reply_to_message) {30 31  await Api.sendMessage({32    chat_id: chat.id,33    text: "⚠️ <b>Reply to the user's message with /unmute</b>",34    parse_mode: "HTML",35    reply_to_message_id: 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 target =50  request.reply_to_message.from;51 52 53if (!target || !target.id) {54 55  await Api.sendMessage({56    chat_id: chatId,57    text: "⚠️ <b>Couldn't identify that user.</b>",58    parse_mode: "HTML",59    reply_to_message_id: request.message_id60  });61 62  return;63}64 65 66var targetId = target.id;67 68 69// ----------------------------------------------------------70// GET NAMES71// ----------------------------------------------------------72 73var adminName =74  String(75    request.from.first_name ||76    request.from.username ||77    "Admin"78  );79 80 81var targetName =82  String(83    target.first_name ||84    target.username ||85    "User"86  );87 88 89if (target.last_name) {90  targetName += " " + String(target.last_name);91}92 93 94// ----------------------------------------------------------95// PREVENT SELF UNMUTE96// ----------------------------------------------------------97 98if (String(adminId) === String(targetId)) {99 100  await Api.sendMessage({101    chat_id: chatId,102    text:103      "😐 <b>" +104      adminName +105      ", you don't need to unmute yourself.</b>",106    parse_mode: "HTML",107    reply_to_message_id: request.message_id108  });109 110  return;111}112 113 114// ----------------------------------------------------------115// CHECK WHO USED /UNMUTE116// ----------------------------------------------------------117 118var adminCheck = await Api.getChatMember({119  chat_id: chatId,120  user_id: adminId121});122 123 124// ----------------------------------------------------------125// ADMIN CHECK FAILED126// ----------------------------------------------------------127 128if (129  !adminCheck ||130  !adminCheck.ok ||131  !adminCheck.result132) {133 134  await Api.sendMessage({135    chat_id: chatId,136    text:137      "⚠️ <b>I couldn't verify your admin status.</b>",138    parse_mode: "HTML",139    reply_to_message_id: request.message_id140  });141 142  return;143}144 145 146var adminStatus =147  adminCheck.result.status;148 149 150// ----------------------------------------------------------151// ONLY ADMINS / OWNER152// ----------------------------------------------------------153 154if (155  adminStatus !== "administrator" &&156  adminStatus !== "creator"157) {158 159  await Api.sendMessage({160    chat_id: chatId,161    text:162      "🚫 <b>Only group admins can use /unmute.</b>",163    parse_mode: "HTML",164    reply_to_message_id: request.message_id165  });166 167  return;168}169 170 171// ----------------------------------------------------------172// CHECK TARGET173// ----------------------------------------------------------174 175var targetCheck = await Api.getChatMember({176  chat_id: chatId,177  user_id: targetId178});179 180 181if (182  !targetCheck ||183  !targetCheck.ok ||184  !targetCheck.result185) {186 187  await Api.sendMessage({188    chat_id: chatId,189    text:190      "⚠️ <b>I couldn't find that user in this group.</b>",191    parse_mode: "HTML",192    reply_to_message_id: request.message_id193  });194 195  return;196}197 198 199// ----------------------------------------------------------200// CHECK TARGET STATUS201// ----------------------------------------------------------202 203var targetStatus =204  targetCheck.result.status;205 206 207// ----------------------------------------------------------208// DON'T UNMUTE BANNED / LEFT USERS209// ----------------------------------------------------------210 211if (212  targetStatus === "left" ||213  targetStatus === "kicked"214) {215 216  await Api.sendMessage({217    chat_id: chatId,218    text:219      "⚠️ <b>" +220      targetName +221      "</b> isn't currently a member of this group.",222    parse_mode: "HTML",223    reply_to_message_id: request.message_id224  });225 226  return;227}228 229 230// ----------------------------------------------------------231// UNMUTE USER232// ----------------------------------------------------------233//234// Restore normal Telegram group permissions.235// ----------------------------------------------------------236 237var unmuteResult =238  await Api.restrictChatMember({239    chat_id: chatId,240    user_id: targetId,241 242    permissions: {243      can_send_messages: true,244      can_send_audios: true,245      can_send_documents: true,246      can_send_photos: true,247      can_send_videos: true,248      can_send_video_notes: true,249      can_send_voice_notes: true,250      can_send_polls: true,251      can_send_other_messages: true,252      can_add_web_page_previews: true253    }254  });255 256 257// ----------------------------------------------------------258// UNMUTE FAILED259// ----------------------------------------------------------260 261if (!unmuteResult || !unmuteResult.ok) {262 263  await Api.sendMessage({264    chat_id: chatId,265    text:266      "❌ <b>I couldn't unmute " +267      targetName +268      ".</b>\n\n" +269      "Make sure Gift is an admin and has permission to restrict members.",270    parse_mode: "HTML",271    reply_to_message_id: request.message_id272  });273 274  return;275}276 277 278// ----------------------------------------------------------279// SUCCESS280// ----------------------------------------------------------281 282await Api.sendMessage({283  chat_id: chatId,284  text:285    "🔊 <b>" +286    targetName +287    "</b> has been unmuted.\n\n" +288    "👑 Admin: <a href=\"tg://user?id=" +289    adminId +290    "\">" +291    adminName +292    "</a>",293  parse_mode: "HTML",294  reply_to_message_id: request.message_id295});