🤖 CC-Chatty — IF / THEN Chat
Type something and watch which rule fires in the code panel
cc-chatty.js — Bot Logic
// ───────────────────────────────────────────── // CC-Chatty — IF / THEN / ELSE Logic // Author: Robert Bestwick | GEN AI Chapter 1 // Topics: Exams, Music, Entertainment, College // ───────────────────────────────────────────── function ccChatty(message) { // Normalize: convert to lowercase for matching let msg = message.toLowerCase(); if (msg.includes("hi") || msg.includes("hello")) { return "Hey! 👋 I'm CC-Chatty. How can I help?"; } else if (msg.includes("exam") || msg.includes("test")) { return studyTips(); } else if (msg.includes("music") || msg.includes("playlist")) { return musicRec(); } else if (msg.includes("bored") || msg.includes("fun")) { return entertainment(); } else if (msg.includes("college") || msg.includes("university")) { return collegeAdvice(); } else if (msg.includes("stress") || msg.includes("anxious")) { return "Take a breath 🌬️ You've got this!\n• 5-min walk\n• Hydrate 💧\n• Break tasks into small steps"; } else if (msg.includes("joke")) { return joke(); } else if (msg.includes("bye") || msg.includes("goodbye")) { return "See you! 🚀 Good luck with everything!"; } else if (msg.includes("help")) { return menu(); } else { return "Hmm, not sure about that 🤔\nType 'help' to see what I can do!"; } } // ── Helper: Study Tips ── function studyTips() { return "📝 Exam tips:\n• Study in 25-min blocks (Pomodoro)\n• Sleep 8hrs the night before\n• Review notes — don't just re-read\n• Practice past papers!"; } // ── Helper: Music Recs ── function musicRec() { const recs = [ "🎵 For studying: Lo-fi hip-hop or classical\nTry 'lofi girl' on YouTube!", "🎧 Trending now: Pop, R&B, Latin\nWhat's your vibe?", "🎸 Focus playlist: Instrumental rock\nor ambient electronic works great!" ]; return recs[Math.floor(Math.random() * recs.length)]; } // ── Helper: Entertainment ── function entertainment() { return "😎 Beat the boredom:\n🎮 Gaming: Minecraft, Fortnite, Roblox\n📺 Shows: Stranger Things, Wednesday\n🎵 Music or a quick walk outside!"; } // ── Helper: College Advice ── function collegeAdvice() { return "🎓 College tips:\n• Keep GPA up — it matters!\n• Join clubs & extracurriculars\n• Visit campuses if you can\n• Start essays early 📄\n• FAFSA = free money, apply!"; } // ── Helper: Jokes ── function joke() { const jokes = [ "Why did the student eat his homework?\nBecause the teacher told him\nit was a piece of cake! 🍰", "What do you call a bear\nwith no teeth?\nA gummy bear! 🐻", "Why can't you trust atoms?\nBecause they make up everything! ⚛️" ]; return jokes[Math.floor(Math.random() * jokes.length)]; } // ── Helper: Menu ── function menu() { return "I can help with:\n📝 'exam' — study tips\n🎵 'music' — playlist ideas\n😎 'bored' — entertainment\n🎓 'college' — advice\n😰 'stress' — chill out tips\n😂 'joke' — a laugh\n👋 'bye' — see you!"; }
🤖
CC-Chatty
● online
Last rule fired:
— waiting for a message —