themasterofficial3/sahistavaloraXbotPublic · Bot Template

AIMulti-file sharing bot that lets users start an upload session with /upload, collect photos, videos, documents, audio, stickers and animations, then package them into a shareable start-link using Bot storage. The wildcard command watches for upload-mode messages and the finish action, /start with a hash param retrieves and sends stored files, /cancel aborts sessions, and /stats tracks user and command counters. Callback handling supports help/upload buttons, and the error command logs exceptions.

Utilityfile-sharinguploaddownloadshare-linkmediainline-keyboard
ProfileTelegram
7 commands0 envUpdated 23d agoCreated Aug 14, 2026
Back to folder

commands/_start.js

javascript · 91 lines

Raw
1/**#command2name: /start3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12/*command: /start*/13if (!params) {14    let welcome_keyboard = [15        [{ text: "📤 Start Uploading", callback_data: "/upload" }]16    ]17    18    Bot.sendMessage(19        "<b>📤 Welcome to Multi File Sharing Bot!</b>\n\n" +20        "With this bot, you can:\n" +21        "• Upload <b>multiple photos, videos, documents, stickers, audios, voices, animations</b>.\n" +22        "• Get a <b>unique shareable link</b> for your uploaded files.\n" +23        "• Share that link anywhere, and anyone can open it to view/download your files.\n\n" +24        "⚡ <b>How to use:</b>\n" +25        "1. Type <code>/upload</code> to start an upload session.\n" +26        "2. Send all your media files one by one.\n" +27        "3. When finished, type ✅ to confirm upload.\n" +28        "4. You will get a shareable link to your uploaded files.\n\n" +29        "🚀 Start sharing your files now!\n" +30        "🔥 <b> Powered By: <a href=\"https://t.me/ThaMaster0\">THE MASTER</a></b> ❤️",31        {32            parse_mode: "HTML",33            disable_web_page_preview: true,34            reply_markup: { inline_keyboard: welcome_keyboard }35        }36    )37} else {38    // File download via hash39    let files_data = Bot.get(params)40    41    if (!files_data || !files_data.files || files_data.files.length === 0) {42        Api.sendMessage("❌ No media found for this link or link has expired.")43        return44    }45    46    let files = files_data.files47 48    // Send all media files49    for (let i = 0; i < files.length; i++) {50        let file = files[i]51        let result = null52        53        if (file.type === "photo") {54            result = Api.sendPhoto({ chat_id: chat.id, photo: file.file_id, caption: file.caption || "" })55        } else if (file.type === "video") {56            result = Api.sendVideo({ chat_id: chat.id, video: file.file_id, caption: file.caption || "" })57        } else if (file.type === "audio") {58            result = Api.sendAudio({ chat_id: chat.id, audio: file.file_id })59        } else if (file.type === "voice") {60            result = Api.sendVoice({ chat_id: chat.id, voice: file.file_id })61        } else if (file.type === "document") {62            result = Api.sendDocument({ chat_id: chat.id, document: file.file_id })63        } else if (file.type === "animation") {64            result = Api.sendAnimation({ chat_id: chat.id, animation: file.file_id })65        } else if (file.type === "sticker") {66            result = Api.sendSticker({67                chat_id: chat.id,68                sticker: file.file_id69            })70        }71 72        // Small delay between files73        if (i < files.length - 1) {74            let wait = Date.now() + 50075            while (Date.now() < wait) {}76        }77    }78 79    // Send note message80    Api.sendMessage({81        chat_id: chat.id,82        text: "✅ <b>Files shared successfully!</b>\n\n" +83              "💡 <i>You can share the link with others to access these files anytime.</i>",84        parse_mode: "HTML",85        reply_markup: {86            inline_keyboard: [[87                { text: "🔗 Join Channel", url: "https://t.me/ThaMaster0" }88            ]]89        }90    })91}