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

javascript · 390 lines

Raw
1/**#command2name: /broadcastgc3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12// ==========================================================13// 📢 GIFT — /broadcastgc14// ADMIN-ONLY GC BROADCAST15//16// TEXT:17// /broadcastgc GC_ID Your message here18//19// IMAGE:20// Reply to an image with:21// /broadcastgc GC_ID22//23// IMAGE + CAPTION:24// Reply to an image with:25// /broadcastgc GC_ID Your caption26//27// ==========================================================28 29 30// ==========================================================31// 👑 ADMINS32// ==========================================================33 34var admins = [35  "8031061590"36];37 38 39// ==========================================================40// 🔐 GET SENDER ID41// ==========================================================42 43var senderId =44  String(45    request &&46    request.from &&47    request.from.id48      ? request.from.id49      : ""50  );51 52 53// ==========================================================54// 🚫 ADMIN CHECK55// ==========================================================56 57if (admins.indexOf(senderId) === -1) {58 59  await Api.sendMessage({60    chat_id: chat.id,61    text: "❌ <b>You don't have permission to use this command.</b>",62    parse_mode: "HTML",63    reply_to_message_id:64      request ? request.message_id : undefined65  });66 67  return;68}69 70 71// ==========================================================72// 📥 GET PARAMETERS73// ==========================================================74 75var input = String(params || "").trim();76 77 78// ==========================================================79// ⚠️ NO INPUT80// ==========================================================81 82if (!input) {83 84  await Api.sendMessage({85    chat_id: chat.id,86 87    text:88      "⚠️ <b>Usage:</b>\n\n" +89 90      "📝 <b>Text:</b>\n" +91      "<code>/broadcastgc GC_ID Your message</code>\n\n" +92 93      "🖼️ <b>Image:</b>\n" +94      "Reply to an image with:\n" +95      "<code>/broadcastgc GC_ID</code>\n\n" +96 97      "🖼️ <b>Image + caption:</b>\n" +98      "Reply to an image with:\n" +99      "<code>/broadcastgc GC_ID Your caption</code>",100 101    parse_mode: "HTML",102    reply_to_message_id:103      request ? request.message_id : undefined104  });105 106  return;107}108 109 110// ==========================================================111// 🔍 SPLIT INPUT112// ==========================================================113 114var parts = input.split(/\s+/);115 116 117// ==========================================================118// 👥 GET GC ID119// ==========================================================120 121var groupId = String(parts.shift()).trim();122 123 124// ==========================================================125// 🔍 VALIDATE GC ID126// ==========================================================127 128if (!/^-100\d+$/.test(groupId)) {129 130  await Api.sendMessage({131    chat_id: chat.id,132 133    text:134      "❌ <b>Invalid GC ID.</b>\n\n" +135      "Example:\n" +136      "<code>-1001234567890</code>",137 138    parse_mode: "HTML",139    reply_to_message_id:140      request ? request.message_id : undefined141  });142 143  return;144}145 146 147// ==========================================================148// 📝 GET TEXT / CAPTION149// ==========================================================150 151var broadcastText =152  parts.join(" ").trim();153 154 155// ==========================================================156// 🔎 GET REPLIED MESSAGE157// ==========================================================158 159var repliedMessage = null;160 161if (162  request &&163  request.reply_to_message164) {165 166  repliedMessage =167    request.reply_to_message;168}169 170 171// ==========================================================172// 🖼️ FIND PHOTO173// ==========================================================174 175var photoFileId = null;176 177if (178  repliedMessage &&179  repliedMessage.photo &&180  Array.isArray(repliedMessage.photo) &&181  repliedMessage.photo.length > 0182) {183 184  var largestPhoto =185    repliedMessage.photo[186      repliedMessage.photo.length - 1187    ];188 189  if (190    largestPhoto &&191    largestPhoto.file_id192  ) {193 194    photoFileId =195      String(largestPhoto.file_id);196  }197}198 199 200// ==========================================================201// ⚠️ NO CONTENT202// ==========================================================203 204if (205  !photoFileId &&206  !broadcastText207) {208 209  await Api.sendMessage({210    chat_id: chat.id,211 212    text:213      "⚠️ <b>No broadcast content provided.</b>\n\n" +214 215      "📝 <b>Text:</b>\n" +216      "<code>/broadcastgc GC_ID Your message</code>\n\n" +217 218      "🖼️ <b>Image:</b>\n" +219      "Reply directly to an image with:\n" +220      "<code>/broadcastgc GC_ID</code>",221 222    parse_mode: "HTML",223    reply_to_message_id:224      request ? request.message_id : undefined225  });226 227  return;228}229 230 231// ==========================================================232// 🖼️ IMAGE BROADCAST233// ==========================================================234 235if (photoFileId) {236 237  var imageOptions = {238    chat_id: groupId,239    photo: photoFileId240  };241 242 243  // --------------------------------------------------------244  // CAPTION FROM COMMAND245  // --------------------------------------------------------246 247  if (broadcastText) {248 249    imageOptions.caption =250      broadcastText;251 252  }253 254 255  // --------------------------------------------------------256  // KEEP ORIGINAL CAPTION257  // --------------------------------------------------------258 259  else if (260    repliedMessage.caption &&261    String(repliedMessage.caption).trim()262  ) {263 264    imageOptions.caption =265      String(repliedMessage.caption);266 267  }268 269 270  // --------------------------------------------------------271  // SEND IMAGE272  // --------------------------------------------------------273 274  try {275 276    await Api.sendPhoto(imageOptions);277 278 279    // ======================================================280    // ✅ SUCCESS281    // ======================================================282 283    await Api.sendMessage({284      chat_id: chat.id,285 286      text:287        "📢 <b>GC Image Broadcast Sent!</b>\n\n" +288        "👥 <b>GC ID:</b> <code>" +289        groupId +290        "</code>\n" +291        "🖼️ <b>Type:</b> Image\n" +292        "✅ <b>Delivered successfully.</b>",293 294      parse_mode: "HTML",295      reply_to_message_id:296        request ? request.message_id : undefined297    });298 299  } catch (e) {300 301    // ======================================================302    // ❌ IMAGE FAILED303    // ======================================================304 305    await Api.sendMessage({306      chat_id: chat.id,307 308      text:309        "❌ <b>GC Image Broadcast Failed.</b>\n\n" +310        "👥 <b>GC ID:</b> <code>" +311        groupId +312        "</code>\n\n" +313 314        "Make sure Gift:\n" +315        "• Is inside the GC\n" +316        "• Can send messages\n" +317        "• Can send photos\n" +318        "• The GC ID is correct.",319 320      parse_mode: "HTML",321      reply_to_message_id:322        request ? request.message_id : undefined323    });324 325  }326 327  return;328}329 330 331// ==========================================================332// 📝 TEXT BROADCAST333// ==========================================================334 335try {336 337  await Api.sendMessage({338    chat_id: groupId,339    text: broadcastText340  });341 342 343  // ========================================================344  // ✅ SUCCESS345  // ========================================================346 347  await Api.sendMessage({348    chat_id: chat.id,349 350    text:351      "📢 <b>GC Broadcast Sent!</b>\n\n" +352      "👥 <b>GC ID:</b> <code>" +353      groupId +354      "</code>\n" +355      "📝 <b>Type:</b> Text\n" +356      "✅ <b>Delivered successfully.</b>",357 358    parse_mode: "HTML",359    reply_to_message_id:360      request ? request.message_id : undefined361  });362 363} catch (e) {364 365  // ========================================================366  // ❌ TEXT FAILED367  // ========================================================368 369  await Api.sendMessage({370    chat_id: chat.id,371 372    text:373      "❌ <b>GC Broadcast Failed.</b>\n\n" +374      "👥 <b>GC ID:</b> <code>" +375      groupId +376      "</code>\n\n" +377 378      "Make sure Gift:\n" +379      "• Is inside the GC\n" +380      "• Has permission to send messages\n" +381      "• The GC ID is correct.",382 383    parse_mode: "HTML",384    reply_to_message_id:385      request ? request.message_id : undefined386  });387 388}389 390return;