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

javascript · 333 lines

Raw
1/**#command2name: /promote3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12// ==========================================================13// 👑 GIFT AI — /promote14// FAST • RESPONSIVE • ADMIN ONLY15//16// • Reply to a user's message with /promote17// • Checks the person using /promote is an admin18// • Checks the target user19// • Promotes the target to administrator20// • Does NOT give the new admin permission to promote others21// • Replies directly to the /promote 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:34      "⚠️ <b>Reply to the user's message with /promote</b>",35    parse_mode: "HTML",36    reply_to_message_id:37      request ? request.message_id : undefined38  });39 40  return;41}42 43 44// ----------------------------------------------------------45// GET DATA46// ----------------------------------------------------------47 48var chatId = chat.id;49var adminId = request.from.id;50 51var target =52  request.reply_to_message.from;53 54 55if (!target || !target.id) {56 57  await Api.sendMessage({58    chat_id: chatId,59    text:60      "⚠️ <b>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 =77  String(78    request.from.first_name ||79    request.from.username ||80    "Admin"81  );82 83 84var targetName =85  String(86    target.first_name ||87    target.username ||88    "User"89  );90 91 92if (target.last_name) {93  targetName += " " + String(target.last_name);94}95 96 97// ----------------------------------------------------------98// PREVENT SELF PROMOTION99// ----------------------------------------------------------100 101if (String(adminId) === String(targetId)) {102 103  await Api.sendMessage({104    chat_id: chatId,105    text:106      "😐 <b>You can't promote yourself.</b>",107    parse_mode: "HTML",108    reply_to_message_id: request.message_id109  });110 111  return;112}113 114 115// ----------------------------------------------------------116// CHECK WHO USED /PROMOTE117// ----------------------------------------------------------118 119var adminCheck =120  await Api.getChatMember({121    chat_id: chatId,122    user_id: adminId123  });124 125 126// ----------------------------------------------------------127// ADMIN CHECK FAILED128// ----------------------------------------------------------129 130if (131  !adminCheck ||132  !adminCheck.ok ||133  !adminCheck.result134) {135 136  await Api.sendMessage({137    chat_id: chatId,138    text:139      "⚠️ <b>I couldn't verify your admin status.</b>",140    parse_mode: "HTML",141    reply_to_message_id: request.message_id142  });143 144  return;145}146 147 148var adminStatus =149  adminCheck.result.status;150 151 152// ----------------------------------------------------------153// ONLY ADMIN / CREATOR154// ----------------------------------------------------------155 156if (157  adminStatus !== "administrator" &&158  adminStatus !== "creator"159) {160 161  await Api.sendMessage({162    chat_id: chatId,163    text:164      "🚫 <b>Only group admins can use /promote.</b>",165    parse_mode: "HTML",166    reply_to_message_id: request.message_id167  });168 169  return;170}171 172 173// ----------------------------------------------------------174// CHECK TARGET175// ----------------------------------------------------------176 177var targetCheck =178  await Api.getChatMember({179    chat_id: chatId,180    user_id: targetId181  });182 183 184if (185  !targetCheck ||186  !targetCheck.ok ||187  !targetCheck.result188) {189 190  await Api.sendMessage({191    chat_id: chatId,192    text:193      "⚠️ <b>I couldn't find that user in this group.</b>",194    parse_mode: "HTML",195    reply_to_message_id: request.message_id196  });197 198  return;199}200 201 202var targetStatus =203  targetCheck.result.status;204 205 206// ----------------------------------------------------------207// ALREADY ADMIN208// ----------------------------------------------------------209 210if (211  targetStatus === "administrator" ||212  targetStatus === "creator"213) {214 215  await Api.sendMessage({216    chat_id: chatId,217    text:218      "🛡️ <b>" +219      targetName +220      " is already an administrator.</b>",221    parse_mode: "HTML",222    reply_to_message_id: request.message_id223  });224 225  return;226}227 228 229// ----------------------------------------------------------230// TARGET MUST BE A MEMBER231// ----------------------------------------------------------232 233if (234  targetStatus !== "member" &&235  targetStatus !== "restricted"236) {237 238  await Api.sendMessage({239    chat_id: chatId,240    text:241      "⚠️ <b>" +242      targetName +243      " cannot be promoted from their current status.</b>",244    parse_mode: "HTML",245    reply_to_message_id: request.message_id246  });247 248  return;249}250 251 252// ----------------------------------------------------------253// PROMOTE USER254// ----------------------------------------------------------255//256// The bot must be an administrator with permission to257// add/promote new administrators.258//259// can_promote_members is deliberately FALSE so the new260// administrator cannot promote other administrators.261// ----------------------------------------------------------262 263var promoteResult =264  await Api.promoteChatMember({265    chat_id: chatId,266    user_id: targetId,267 268    can_manage_chat: true,269    can_delete_messages: true,270    can_manage_video_chats: true,271    can_restrict_members: true,272    can_change_info: true,273    can_invite_users: true,274 275    // Do not allow the promoted user to promote others276    can_promote_members: false277  });278 279 280// ----------------------------------------------------------281// PROMOTION FAILED282// ----------------------------------------------------------283 284if (285  !promoteResult ||286  !promoteResult.ok287) {288 289  var errorMessage =290    "Make sure Gift is an administrator and has permission to add new administrators.";291 292  if (293    promoteResult &&294    promoteResult.description295  ) {296    errorMessage =297      promoteResult.description;298  }299 300  await Api.sendMessage({301    chat_id: chatId,302    text:303      "❌ <b>I couldn't promote " +304      targetName +305      ".</b>\n\n" +306      errorMessage,307    parse_mode: "HTML",308    reply_to_message_id: request.message_id309  });310 311  return;312}313 314 315// ----------------------------------------------------------316// SUCCESS317// ----------------------------------------------------------318 319await Api.sendMessage({320  chat_id: chatId,321  text:322    "👑 <b>" +323    targetName +324    " has been promoted to administrator.</b>\n\n" +325    "👤 Promoted by: <a href=\"tg://user?id=" +326    adminId +327    "\">" +328    adminName +329    "</a>\n\n" +330    "Don't embarrass yourself with the new power. 😭💜",331  parse_mode: "HTML",332  reply_to_message_id: request.message_id333});