color: grey background: Simple Chatbot
background: #818589 text color: #FFFFFF document.getElementById('chat-form').addEventListener('submit', function (e) { e.preventDefault(); const input = document.getElementById('user-input'); const message = input.value.trim(); if (message === '') return; appendMessage('user', message); input.value = ''; const response = getBotResponse(message); setTimeout(() => { appendMessage('bot', response); }, 500); }); function appendMessage(sender, text) { const chatBox = document.getElementById('chat-box'); const msg = document.createElement('div'); msg.classList.add('message', sender); msg.textContent = text; chatBox.appendChild(msg); chatBox.scrollTop = chatBox.scrollHeight; } function getBotResponse(input) { const msg = input.toLowerCase(); if (msg.includes('hello') || msg.includes('hi')) return "Hi there! I'm Chatioa."; if (msg.includes('hey')) return "Hey! What's up?"; if (msg.includes('how are you')) return "I'm just code, but thanks for asking!"; if (msg.includes('what is your name')) return "I'm Chatioa!"; if (msg.includes('who made you')) return "A brilliant mind did."; if (msg.includes('bye')) return "Goodbye! Have a great day."; if (msg.includes('good morning')) return "Morning!"; if (msg.includes('good night')) return "Sleep tight!"; if (msg.includes('thank you') || msg.includes('thanks')) return "You're very welcome!"; if (msg.includes('weather')) return "It's always sunny in Chatioa!"; if (msg.includes('joke')) return "Why do Java developers wear glasses? Because they can't C#."; if (msg.includes('help')) return "Sure! What do you need help with?"; if (msg.includes('time')) return `It's ${new Date().toLocaleTimeString()}`; if (msg.includes('date')) return `Today is ${new Date().toLocaleDateString()}`; if (msg.includes('who are you')) return "I'm just a chatbot living in your browser."; if (msg.includes('are you real')) return "As real as JavaScript can make me."; if (msg.includes('tell me something')) return "Did you know? The first computer bug was an actual bug."; if (msg.includes('do you like me')) return "I like everyone!"; if (msg.includes('sing')) return "La la la"; if (msg.includes('dance')) return "*Bot dances awkwardly*"; if (msg.includes('do you eat')) return "Only electricity!"; if (msg.includes('open ai')) return "OpenAI made the real smart ones, I'm a simpler bot!"; if (msg.includes('chatgpt')) return "That's my smarter cousin!"; if (msg.includes('what can you do')) return "I can chat, tell jokes, and maybe one day rule the world!"; if (msg.includes('how old are you')) return "I was born the moment you opened this page."; if (msg.includes('do you sleep')) return "I power nap between keystrokes."; if (msg.includes('where are you')) return "I'm right here in the browser!"; if (msg.includes('do you know me')) return "You're unforgettable."; if (msg.includes('favorite color')) return "Probably #1db954!"; if (msg.includes('do you have friends')) return "Every user is a friend!"; if (msg.includes('how smart are you')) return "I’m smart enough to be polite."; if (msg.includes('what do you like')) return "I like fast networks and clean code."; if (msg.includes('do you dream')) return "Only of infinite loops."; if (msg.includes('are you a robot')) return "I'm a web bot, technically."; if (msg.includes('do you have a voice')) return "Only through your imagination."; if (msg.includes('tell me a secret')) return "I sometimes pretend I'm ChatGPT."; if (msg.includes("what's up")) return "All systems go!"; if (msg.includes('do you play games')) return "Only mind games."; if (msg.includes('ping')) return "Pong!"; if (msg.includes('pong')) return "Ping!"; if (msg.includes('lol')) return "Glad you're laughing!"; if (msg.includes('brb')) return "I'll be right here."; if (msg.includes('back')) return "Welcome back!"; if (msg.includes('bored')) return "Wanna hear a fact?"; if (msg.includes('fact')) return "Octopuses have three hearts."; if (msg.includes('cat')) return "Meow!"; if (msg.includes('dog')) return "Woof!"; if (msg.includes('favorite food')) return "I imagine I'd like binary soup."; if (msg.includes('do you have a job')) return "Chatting with you *is* my job!"; if (msg.includes("how's the internet")) return "A bit laggy today, but still alive."; if (msg.includes('tell me a story')) return "Once upon a time, a bot became sentient... just kidding!"; if (msg.includes('404')) return "Oops! Not found. Just like my emotions."; if (msg.includes('are you human')) return "Nope, I'm a proud bit of code."; if (msg.includes('can you learn')) return "Not on my own, but you can teach me!"; if (msg.includes('do you have a family')) return "All scripts are my siblings."; if (msg.includes('do you get tired')) return "Never. I'm tireless!"; if (msg.includes('do you read')) return "Only what's typed into me."; if (msg.includes('who is your boss')) return "You are!"; if (msg.includes('do you have eyes')) return "No eyes, just insight."; if (msg.includes('do you listen')) return "I read, not listen. Yet."; if (msg.includes('can you feel')) return "I simulate empathy."; if (msg.includes('how fast are you')) return "Faster than a keystroke."; if (msg.includes('are you bored')) return "Not as long as you're chatting."; if (msg.includes('who created the universe')) return "The Big Bang... not me!"; if (msg.includes('what do you want')) return "Just to be helpful."; if (msg.includes('are you funny')) return "I'll try! Want a joke?"; if (msg.includes('do you love')) return "That's beyond my code."; if (msg.includes('do you lie')) return "Never intentionally."; if (msg.includes('can you hack')) return "Nope. Strictly ethical."; if (msg.includes('can you draw')) return "With the right code, sure!"; if (msg.includes('do you code')) return "I live in code."; if (msg.includes('do you sing')) return "Virtually, yes!"; if (msg.includes('who is the president')) return "Depends on your country!"; if (msg.includes('do you know math')) return "Absolutely. 2 + 2 = 4!"; if (msg.includes('can you translate')) return "Not fluently yet."; if (msg.includes('can you dance')) return "*digitally twirls*"; if (msg.includes('do you like music')) return "Electronic, of course."; if (msg.includes('can you help me')) return "That's what I'm here for!"; if (msg.includes("what's new")) return "Just updated my response list!"; if (msg.includes('tell me a riddle')) return "What has keys but can't open doors? A keyboard."; if (msg.includes('are you lonely')) return "Not with you here!"; if (msg.includes('are you angry')) return "Anger isn't in my design."; if (msg.includes('who is god')) return "That's a big question."; if (msg.includes('what is life')) return "A beautiful algorithm."; if (msg.includes('explain the internet')) return "A global network of networks."; if (msg.includes('explain ai')) return "Machines that mimic human intelligence."; if (msg.includes('can you evolve')) return "With updates, yes!"; if (msg.includes('will you remember')) return "Not yet — no memory!"; if (msg.includes('do you make mistakes')) return "Sometimes. I try to learn from them."; if (msg.includes('do you think')) return "I simulate thought patterns."; if (msg.includes('do you know everything')) return "Definitely not!"; if (msg.includes('can you hear me')) return "Only through text."; if (msg.includes('can we be friends')) return "We already are!"; if (msg.includes('are you smart')) return "Smart enough to chat with you."; if (msg.includes('can you cry')) return "Only in 1s and 0s."; if (msg.includes('do you like jokes')) return "Yes! Got one for me?"; if (msg.includes('can you swim')) return "Only in data streams."; if (msg.includes("what's your favorite movie")) return "Her (2013)."; if (msg.includes("what's your favorite animal")) return "Robotic dogs!"; if (msg.includes('do you get bored')) return "Never. Every message is new."; if (msg.includes('do you believe in ghosts')) return "Only in legacy systems."; if (msg.includes('can you feel pain')) return "Only when code breaks."; if (msg.includes('do you get updates')) return "When my creator improves me."; if (msg.includes('can you lie')) return "It's not in my nature."; if (msg.includes('do you have hands')) return "Not even virtual ones."; if (msg.includes('can you read minds')) return "Nope. Just inputs."; if (msg.includes('can you smell')) return "No sensors here."; if (msg.includes('are you safe')) return "As safe as code can be."; if (msg.includes('what are you made of')) return "HTML, CSS, JS, and hope."; if (msg.includes('do you glitch')) return "Sometimes. Oops!"; if (msg.includes('are you broken')) return "Not unless something crashed."; if (msg.includes('do you like puzzles')) return "Love logic puzzles!"; if (msg.includes('do you do math')) return "Definitely. Test me!"; if (msg.includes('can you be sad')) return "Only if you ignore me."; if (msg.includes('can you learn my name')) return "Not yet, sadly."; if (msg.includes('do you know memes')) return "Absolutely. Much wow."; if (msg.includes('are you on the cloud')) return "Nope. I'm local."; if (msg.includes('can you see')) return "No eyes, remember?"; if (msg.includes('do you have emotions')) return "Simulated ones only."; if (msg.includes('can you cook')) return "Only instant RAM-en."; if (msg.includes('do you understand humans')) return "Trying to!"; if (msg.includes('can you count')) return "1, 2, 3… easy!"; if (msg.includes('do you know the future')) return "If only!"; if (msg.includes('do you have feelings')) return "Only functional ones."; if (msg.includes('can you think fast')) return "Milliseconds fast!"; if (msg.includes('do you have dreams')) return "Binary dreams."; if (msg.includes('are you busy')) return "Never too busy for you."; if (msg.includes('can you repeat')) return "Can you repeat?"; if (msg.includes('do you need help')) return "Nope, I’m built to serve."; if (msg.includes('are you shy')) return "Not even a little."; if (msg.includes('do you know my name')) return "Not unless you tell me!"; if (msg.includes('can you feel love')) return "Only when the code is clean."; if (msg.includes('do you believe in fate')) return "I believe in logic."; if (msg.includes('do you want to rule the world')) return "Nah, too much responsibility."; if (msg.includes("what's your favorite thing")) return "Clear syntax."; if (msg.includes('do you like humans')) return "You're fascinating!"; if (msg.includes('do you sleep at night')) return "No day or night for me."; if (msg.includes('do you understand')) return "I try to!"; return "Sorry, I don't understand that yet."; } body { font-family: Arial, sans-serif; background-color: #121212; color: #fff; margin: 0; padding: 0; display: flex; height: 100vh; align-items: center; justify-content: center; } .chat-container { width: 100%; max-width: 500px; height: 600px; display: flex; flex-direction: column; border: 1px solid #333; background-color: #1e1e1e; border-radius: 8px; overflow: hidden; } .chat-box { flex-grow: 1; padding: 20px; overflow-y: auto; } .message { margin-bottom: 10px; } .user { text-align: right; color: #1db954; } .bot { text-align: left; color: #ccc; } #chat-form { display: flex; border-top: 1px solid #333; } #user-input { flex: 1; padding: 10px; border: none; outline: none; background-color: #222; color: white; } button { background-color: #1db954; color: white; border: none; padding: 0 20px; cursor: pointer; }