xseaqbka/Nawaab_RoBotPublic · Bot Template
AIThis Telegram bot acts as a TOTP authenticator: users can add accounts via Base32 secret, QR code, or otpauth:// URI, list saved keys, and generate current OTP codes on demand with refresh and delete options. It includes an admin panel with user ban/unban, paginated user management, required-channel management, and a broadcast system that sends text, image, or copied replied messages to all private chats. A web dashboard endpoint provides OTP generation and account management over HTTP. The bot also supports an on/off maintenance switch and per-user access gating.
Utilitytotpauthenticatorotp2fabroadcastadmin
59 commands1 envUpdated 10d agoCreated Aug 28, 2026
commands/_bd_confirm.js
javascript · 245 lines
1/**#command2name: /bd_confirm3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12/* Command: /bd_confirm */13 14if (!(await authUtils.adminOnly())) return;15 16 17/* =========================================================18 GET SAVED BROADCAST SOURCE19 ========================================================= */20 21const sourceMessageId =22 await db.user.get(23 "broadcast_message_id",24 025 );26 27const sourceChatId =28 await db.user.get(29 "broadcast_source_chat_id",30 031 );32 33 34/* =========================================================35 VALIDATE BROADCAST SESSION36 ========================================================= */37 38if (39 !sourceMessageId ||40 !sourceChatId41) {42 43 await Api.sendMessage({44 chat_id: chat.id,45 46 text:47 "❌ <b>Broadcast Session Expired</b>\n\n" +48 "The original message could not be found.\n\n" +49 "Please reply to the message you want to broadcast " +50 "and send <code>/bd</code> again.",51 52 parse_mode: "HTML",53 54 reply_markup: {55 inline_keyboard: [56 [57 authUtils.btn(58 "📖 Broadcast Help",59 "admin_help",60 "primary"61 )62 ],63 64 [65 authUtils.btn(66 "✕ Close",67 "close",68 "danger"69 )70 ]71 ]72 }73 });74 75 return;76}77 78 79/* =========================================================80 COUNT TARGET USERS81 ========================================================= */82 83const totalUsers =84 await Bot.getUsers({85 chatType: "private",86 countOnly: true87 });88 89 90/* =========================================================91 START BROADCAST92 ========================================================= */93 94let job;95 96try {97 98 job =99 await Bot.broadcast({100 101 /*102 * copyMessage allows Telegram to copy the103 * original message without rebuilding it.104 *105 * This supports arbitrary Telegram message types.106 */107 method: "copyMessage",108 109 body: {110 from_chat_id:111 sourceChatId,112 113 message_id:114 sourceMessageId115 },116 117 filters: {118 chatType: "private"119 }120 });121 122} catch (e) {123 124 await Api.sendMessage({125 chat_id: chat.id,126 127 text:128 "❌ <b>Broadcast Could Not Be Started</b>\n\n" +129 "Telegram/TBL rejected the broadcast request.\n\n" +130 "Please try again.",131 132 parse_mode: "HTML",133 134 reply_markup: {135 inline_keyboard: [136 [137 authUtils.btn(138 "📣 Try Again",139 "broadcast",140 "primary"141 )142 ],143 144 [145 authUtils.btn(146 "✕ Close",147 "close",148 "danger"149 )150 ]151 ]152 }153 });154 155 return;156}157 158 159/* =========================================================160 CLEAR SESSION161 ========================================================= */162 163await db.user.set(164 "broadcast_message_id",165 null166);167 168await db.user.set(169 "broadcast_source_chat_id",170 null171);172 173 174/* =========================================================175 SUCCESS176 ========================================================= */177 178const broadcastId =179 job?.broadcastId || "—";180 181const targetCount =182 job?.totalTargetChats ||183 totalUsers ||184 0;185 186const batches =187 job?.totalBatches ||188 "—";189 190 191await Api.sendMessage({192 chat_id: chat.id,193 194 text:195 "🚀 <b>Broadcast Started</b>\n\n" +196 197 "Your message has been queued successfully.\n\n" +198 199 "👥 <b>Recipients:</b> " +200 targetCount +201 "\n" +202 203 "📦 <b>Batches:</b> " +204 batches +205 "\n" +206 207 "🆔 <b>Job ID:</b>\n" +208 "<code>" +209 authUtils.escapeHtml(210 String(broadcastId)211 ) +212 "</code>\n\n" +213 214 "<i>The original message is being copied to " +215 "all private users.</i>",216 217 parse_mode: "HTML",218 219 reply_markup: {220 inline_keyboard: [221 222 [223 authUtils.btn(224 "📊 Statistics",225 "admin_stats",226 "primary"227 ),228 229 authUtils.btn(230 "🛡️ Admin Panel",231 "admin_menu"232 )233 ],234 235 [236 authUtils.btn(237 "✕ Close",238 "close",239 "danger"240 )241 ]242 243 ]244 }245});