millswelbeck148/SireimadeBotPublic · Bot Template
AIGift AI is a command‑based Telegram bot that offers a mix of moderation tools and light‑hearted features. It lets group admins ban, unban, and promote users by replying to messages, while also providing user‑ID lookup and a support link that enforces a forced‑join check. In addition, the bot includes simple games such as tic‑tac‑toe (commands /x and /o) and a Magic 8‑Ball (/8ball). The code uses the TeleBotHost TBL APIs (Bot, Api, db, etc.) and contains no long‑running listeners or external frameworks.
Moderationmoderationadminbanunbanpromoteuser-info
118 commands3 envUpdated 17d agoCreated Aug 27, 2026
commands/_bc.js
javascript · 473 lines
1/**#command2name: /bc3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12// ==========================================================13// 🛡️ MINI MODERATOR — UNIVERSAL BROADCAST14// TELEBOTHOST / TBL15//16// OWNER ONLY17//18// SUPPORTS:19// • TEXT20// • PHOTO21// • VIDEO22// • DOCUMENT23// • AUDIO24// • VOICE25// • ANIMATION / GIF26// • STICKER27//28// USAGE:29//30// /broadcast Hello everyone31//32// OR:33//34// Reply to a photo/video/document/audio/voice/GIF/sticker35// with:36//37// /broadcast38//39// OR:40//41// Reply to media with:42//43// /broadcast New caption44// ==========================================================45 46// ==========================================================47// CONFIG48// ==========================================================49 50var OWNER_ID = "8031061590";51 52// ==========================================================53// OWNER CHECK54// ==========================================================55 56if (!user || String(user.id) !== OWNER_ID) {57return Bot.sendMessage("❌ Owner only.");58}59 60// ==========================================================61// GET FULL TELEGRAM MESSAGE62//63// IMPORTANT:64// The message global can be text-only.65// update.message contains the full Telegram message,66// including photo, video, sticker, etc.67// ==========================================================68 69var source = null;70 71// Try full update first.72 73if (74typeof update !== "undefined" &&75update &&76update.message77) {78source = update.message;79}80 81// Fallback.82 83if (84!source &&85typeof message !== "undefined" &&86message87) {88source = message;89}90 91// ==========================================================92// SAFETY93// ==========================================================94 95if (!source) {96return Bot.sendMessage(97"❌ I couldn't read this message."98);99}100 101// ==========================================================102// IF THIS IS A REPLY, USE THE REPLIED MESSAGE WHEN103// THE CURRENT MESSAGE DOES NOT CONTAIN MEDIA104// ==========================================================105 106var currentHasMedia = false;107 108// PHOTO109 110if (source.photo) {111currentHasMedia = true;112}113 114// VIDEO115 116if (source.video) {117currentHasMedia = true;118}119 120// DOCUMENT121 122if (source.document) {123currentHasMedia = true;124}125 126// AUDIO127 128if (source.audio) {129currentHasMedia = true;130}131 132// VOICE133 134if (source.voice) {135currentHasMedia = true;136}137 138// ANIMATION / GIF139 140if (source.animation) {141currentHasMedia = true;142}143 144// STICKER145 146if (source.sticker) {147currentHasMedia = true;148}149 150// Use replied-to message when current message is151// only the /broadcast command.152 153if (154!currentHasMedia &&155source.reply_to_message156) {157 158source = source.reply_to_message;159 160}161 162// ==========================================================163// COMMAND PARAMETERS164// ==========================================================165 166var commandText = "";167 168if (169typeof params !== "undefined" &&170params !== null171) {172commandText = String(params).trim();173}174 175// ==========================================================176// VARIABLES177// ==========================================================178 179var method = "";180var body = {};181var caption = "";182 183// ==========================================================184// PRESERVE ORIGINAL CAPTION185// ==========================================================186 187if (source.caption) {188caption = String(source.caption);189}190 191// ==========================================================192// /broadcast TEXT OVERRIDES ORIGINAL CAPTION193// ==========================================================194 195if (commandText) {196caption = commandText;197}198 199// ==========================================================200// PHOTO201// ==========================================================202 203if (204source.photo &&205Array.isArray(source.photo) &&206source.photo.length > 0207) {208 209var photo =210source.photo[source.photo.length - 1];211 212if (213!photo ||214!photo.file_id215) {216 217return Bot.sendMessage( 218 "❌ I couldn't read the photo." 219);220 221}222 223method = "sendPhoto";224 225body = {226photo: photo.file_id227};228 229if (caption) {230body.caption = caption;231}232 233}234 235// ==========================================================236// VIDEO237// ==========================================================238 239else if (240source.video &&241source.video.file_id242) {243 244method = "sendVideo";245 246body = {247video: source.video.file_id248};249 250if (caption) {251body.caption = caption;252}253 254}255 256// ==========================================================257// DOCUMENT258// ==========================================================259 260else if (261source.document &&262source.document.file_id263) {264 265method = "sendDocument";266 267body = {268document: source.document.file_id269};270 271if (caption) {272body.caption = caption;273}274 275}276 277// ==========================================================278// AUDIO279// ==========================================================280 281else if (282source.audio &&283source.audio.file_id284) {285 286method = "sendAudio";287 288body = {289audio: source.audio.file_id290};291 292if (caption) {293body.caption = caption;294}295 296}297 298// ==========================================================299// VOICE300// ==========================================================301 302else if (303source.voice &&304source.voice.file_id305) {306 307method = "sendVoice";308 309body = {310voice: source.voice.file_id311};312 313if (caption) {314body.caption = caption;315}316 317}318 319// ==========================================================320// ANIMATION / GIF321// ==========================================================322 323else if (324source.animation &&325source.animation.file_id326) {327 328method = "sendAnimation";329 330body = {331animation: source.animation.file_id332};333 334if (caption) {335body.caption = caption;336}337 338}339 340// ==========================================================341// STICKER342//343// Telegram stickers cannot have captions.344// ==========================================================345 346else if (347source.sticker &&348source.sticker.file_id349) {350 351method = "sendSticker";352 353body = {354sticker: source.sticker.file_id355};356 357}358 359// ==========================================================360// PLAIN TEXT361// ==========================================================362 363else {364 365if (!commandText) {366 367return Bot.sendMessage( 368 "📢 BROADCAST\n\n" + 369 "Use:\n" + 370 "/broadcast your message\n\n" + 371 "Or reply to media with /broadcast." 372);373 374}375 376method = "sendMessage";377 378body = {379text: commandText,380disable_web_page_preview: false381};382 383}384 385// ==========================================================386// START BROADCAST387// ==========================================================388 389try {390 391var job = await Bot.broadcast({392 393method: method, 394 395body: body, 396 397filters: { 398 chatType: [ 399 "private", 400 "group" 401 ] 402}403 404});405 406// ========================================================407// VERIFY JOB408// ========================================================409 410if (411!job ||412!job.broadcastId413) {414 415return Bot.sendMessage( 416 "❌ Broadcast could not be started." 417);418 419}420 421// ========================================================422// SAVE ID INTERNALLY423//424// Never show this ID to the owner.425// ========================================================426 427await db.bot.set(428"MINI_MOD_ACTIVE_BROADCAST",429String(job.broadcastId)430);431 432// ========================================================433// CLEAN SUCCESS MESSAGE434// ========================================================435 436Bot.sendMessage(437"✅ Broadcast sent successfully."438);439 440} catch (e) {441 442// ========================================================443// ERROR444// ========================================================445 446var errorText = "";447 448if (449e &&450e.message451) {452 453errorText = String(e.message);454 455} else {456 457errorText = String(e);458 459}460 461if (!errorText) {462 463errorText = 464 "Something went wrong while sending the broadcast.";465 466}467 468Bot.sendMessage(469"❌ Broadcast failed.\n\n" +470errorText471);472 473}