Spaces:
Running
Running
Faça um site que é tipo um bot que quando eles entram no site eles vão ter que criar uma conta ou se tiver só entrar aí depois eles tem que fazer login na conta deles no instagram e depois ter um botão para quando uma pessoa falar a palavra que ele colocar dentro do site o bot responde e tbm no site vai ter todos os reels etc e embaixo do vídeo vai ter um botão adicionar bot ao vídeo para responder automaticamente e ai quando eles clicarem nesse botão vai pedir a palavra que as pessoas vão comentar para o bot responder e depois disso embaixo vai ter um botão de salva e pronto ja vai tar funcionando e tudo gratis
fe58990 verified Download script.js from 02030ooeeeerrrr/instabot-buddy: direct link, hf CLI and curl.
- Browser
- Download file 4.55 kB
-
https://huggingface.co/spaces/02030ooeeeerrrr/instabot-buddy/resolve/main/script.js
- Command line
-
hf download hf://spaces/02030ooeeeerrrr/instabot-buddy/script.js
-
curl -L -o script.js https://huggingface.co/spaces/02030ooeeeerrrr/instabot-buddy/resolve/main/script.js
4.55 kB
| // Main application logic | |
| document.addEventListener('DOMContentLoaded', function() { | |
| // Check if user is logged in | |
| const isLoggedIn = localStorage.getItem('isLoggedIn') === 'true'; | |
| if (isLoggedIn) { | |
| updateUIForLoggedInUser(); | |
| } | |
| // Instagram connection handler | |
| document.getElementById('connectInstagram')?.addEventListener('click', function() { | |
| if (!isLoggedIn) { | |
| alert('Por favor, faça login primeiro.'); | |
| document.querySelector('custom-auth-modal').shadowRoot.querySelector('.modal').classList.remove('hidden'); | |
| return; | |
| } | |
| // In a real app, this would redirect to Instagram OAuth | |
| alert('Redirecionando para o Instagram para autenticação...'); | |
| // Simulate loading reels after connection | |
| setTimeout(() => { | |
| loadSampleReels(); | |
| }, 1500); | |
| }); | |
| }); | |
| function updateUIForLoggedInUser() { | |
| const username = localStorage.getItem('username'); | |
| const navbar = document.querySelector('custom-navbar'); | |
| if (navbar && navbar.shadowRoot) { | |
| const loginBtn = navbar.shadowRoot.querySelector('#loginBtn'); | |
| const userMenu = navbar.shadowRoot.querySelector('#userMenu'); | |
| if (loginBtn) loginBtn.classList.add('hidden'); | |
| if (userMenu) { | |
| userMenu.classList.remove('hidden'); | |
| userMenu.querySelector('span').textContent = username; | |
| } | |
| } | |
| } | |
| function loadSampleReels() { | |
| const reelsContainer = document.getElementById('reelsContainer'); | |
| if (!reelsContainer) return; | |
| reelsContainer.innerHTML = ''; | |
| // Sample reels data - in a real app, this would come from an API | |
| const sampleReels = [ | |
| { id: 1, thumbnail: 'http://static.photos/travel/320x240/1', caption: 'Viagem incrível!', comments: 24 }, | |
| { id: 2, thumbnail: 'http://static.photos/food/320x240/2', caption: 'Receita nova 🍕', comments: 42 }, | |
| { id: 3, thumbnail: 'http://static.photos/nature/320x240/3', caption: 'Pôr do sol maravilhoso', comments: 15 }, | |
| { id: 4, thumbnail: 'http://static.photos/sport/320x240/4', caption: 'Treino pesado hoje!', comments: 8 }, | |
| { id: 5, thumbnail: 'http://static.photos/technology/320x240/5', caption: 'Novo gadget!', comments: 31 }, | |
| { id: 6, thumbnail: 'http://static.photos/minimal/320x240/6', caption: 'Design limpo', comments: 12 } | |
| ]; | |
| sampleReels.forEach(reel => { | |
| const reelElement = document.createElement('div'); | |
| reelElement.className = 'bg-white rounded-xl overflow-hidden shadow-sm reel-card'; | |
| reelElement.innerHTML = ` | |
| <img src="${reel.thumbnail}" alt="${reel.caption}" class="w-full h-48 object-cover"> | |
| <div class="p-4"> | |
| <p class="text-gray-800 font-medium mb-2 line-clamp-2">${reel.caption}</p> | |
| <div class="flex justify-between items-center"> | |
| <span class="text-gray-500 text-sm"><i data-feather="message-square" class="w-4 h-4 inline mr-1"></i> ${reel.comments}</span> | |
| <button class="add-bot-btn text-indigo-600 hover:text-indigo-800 font-medium text-sm" data-reel-id="${reel.id}"> | |
| <i data-feather="plus-circle" class="w-4 h-4 inline mr-1"></i> Adicionar bot | |
| </button> | |
| </div> | |
| </div> | |
| `; | |
| reelsContainer.appendChild(reelElement); | |
| }); | |
| // Add event listeners to all "Add bot" buttons | |
| document.querySelectorAll('.add-bot-btn').forEach(button => { | |
| button.addEventListener('click', function() { | |
| const reelId = this.getAttribute('data-reel-id'); | |
| const botConfig = document.querySelector('custom-bot-config'); | |
| if (botConfig && botConfig.shadowRoot) { | |
| botConfig.shadowRoot.querySelector('.modal').classList.remove('hidden'); | |
| botConfig.shadowRoot.querySelector('input[name="reelId"]').value = reelId; | |
| } | |
| }); | |
| }); | |
| feather.replace(); | |
| } | |
| // Handle successful login | |
| window.handleLoginSuccess = function(username) { | |
| localStorage.setItem('isLoggedIn', 'true'); | |
| localStorage.setItem('username', username); | |
| updateUIForLoggedInUser(); | |
| const authModal = document.querySelector('custom-auth-modal'); | |
| if (authModal && authModal.shadowRoot) { | |
| authModal.shadowRoot.querySelector('.modal').classList.add('hidden'); | |
| } | |
| // Load reels after login | |
| loadSampleReels(); | |
| }; |