stark91611/Username2idtobotPublic · Bot Template

ProfileTelegram

AIUsername info appears to be a Telegram automation bot. Commands include /start, /*, /help, /me, /inline_query, /readme.md, /redeem, /broadcast. Observed in code: messaging, keyboards.

Utilityutility
8 commands0 envUpdated 28d agoCreated Sep 14, 2026
Back to folder

commands/_broadcast.js

javascript · 141 lines

Raw
1/**#command2name: /broadcast3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12const ADMIN_ID =  8745327621 13if (user.telegramid != ADMIN_ID) {14  return15}16 17if (!request.reply_to_message) {18  return Bot.sendMessage(19    "❌ Reply to a message with /broadcast"20  )21}22 23let users = await Bot.getUsers({24  chatType: "private"25})26 27if (!users?.length) {28  return Bot.sendMessage(29    "❌ No users found"30  )31}32 33let msg = request.reply_to_message34 35let sent = 036let failed = 037 38let status = await Api.sendMessage({39  text:40    "📢 Broadcast Started\n\n" +41    "👥 Total: " + users.length42})43 44let hasButtons =45  msg.reply_markup?.inline_keyboard46 47let methods = {48  photo: "sendPhoto",49  video: "sendVideo",50  document: "sendDocument",51  animation: "sendAnimation",52  audio: "sendAudio",53  voice: "sendVoice"54}55 56let type = Object.keys(methods)57  .find(x => msg[x])58 59for (let chat_id of users) {60 61  try {62 63    if (!hasButtons) {64 65      await Api.copyMessage({66        chat_id,67        from_chat_id: msg.chat.id,68        message_id: msg.message_id69      })70 71    } else {72 73      let data = {74        chat_id,75        reply_markup: msg.reply_markup76      }77 78      if (type) {79 80        data[type] =81          type === "photo"82            ? msg.photo.at(-1).file_id83            : msg[type].file_id84 85        data.caption = msg.caption86 87        data.caption_entities =88          msg.caption_entities89 90        await Api.call(91          methods[type],92          data93        )94 95      } else {96 97        data.text =98          msg.text ||99          msg.caption ||100          ""101 102        data.entities =103          msg.entities ||104          msg.caption_entities105 106        await Api.sendMessage(data)107 108      }109 110    }111 112    sent++113 114  } catch {115 116    try {117 118      await Api.forwardMessage({119        chat_id,120        from_chat_id: msg.chat.id,121        message_id: msg.message_id122      })123 124      sent++125 126    } catch {127 128      failed++129 130    }131 132  }133 134}135 136await status.editText(137  "📢 Broadcast Completed\n\n" +138  "👥 Total: " + users.length +139  "\n✅ Sent: " + sent +140  "\n❌ Failed: " + failed141)