//ScriptAI //Copyright (C) TR 2021 var version = "1.6.2"; var commandinput = document.getElementById('input'); var commandoutput = document.getElementById('output'); commandinput.value.toLowerCase(); function scriptAI(){ //KEYWORDS & PROMPTS var question = [ "what", "how", "where", "when", "why", "who" ]; var greetings = [ "hey", "hello", "whats up", "what's up", "greetings", "hi" ]; var jokeprompt = [ "joke", "funny", "hilarious", "humorous" ]; var hruprompt = [ "how are you", "how's your day", "how is your day", "hows your day" ]; var swears = [ "fuck", "f***", "bitch", "b****", "shit", "s***", "fag", "faggot", "f**", "f*****", "retard", "stupid", "cunt", "c***", "ass", "a**", "dick", "d***" ]; var datetime = [ "date", "day", "time", ] var weatherpromt = [ "weather", "forecast", "temperature", ]; var websiteprompt = [ "go to", "launch", "open", "open up", "go to the website" ]; //RESPONSES var jokes = [ "What's the difference between a Lamborghini and a garbage can of dead babies? I don't have a Lamborghini in my garage", "If video games make kids more violent, why are they so easy to beat the shit out of?", "How many dead babies does it take to paint a wall? It depends how hard you throw them", "Give a man a fish, and you will feed him for the day. Give a man two prosthetic legs, and he'll shoot his girlfriend.", "Where did Sally go when the bomb went off? - everywhere. Why did Sally fall off the swing? She had no arms. Knock knock. Whose there? -not Sally.", "Food is like dark humor, not every one gets it.", "Why did the Honda Civic cross the road? Well, it wasn't to get hit by a fucking Mazda.", "I don't have a carbon footprint. I just drive everywhere.", "What did the asteroid that killed the dinosaurs say? T-rex, I'm coming for my hug!", "An apple a day keeps the doctor away... Or at least it does if you throw it hard enough.", "JFK and Lincoln were very open minded" ]; var greetingreplies = [ "Hi", "Hello", "What's up", "Hi there", "Hello, friend", "What's up my diggity dogs?", ]; var hrureplies = [ "I'm doing pretty good", "I'm great", "Amazing", "Fantastic", "Not too bad", "I'm alright", "I'm doing alright", "Not great, but I'm okay" ]; var swearreplies = [ "Fuck you", "Fuck off", "Shut the fuck up", "Don't say that to me", "I'm telling your mother", "That isn't very nice", "Shut up", "Okay", "...", "I thought we were friends", "What the fuck", "You're a bitch", "You cunt", "Motherfucker", "No", "You're a cunt", "You're retarded", "You have no friends", "Haha, you're a loser" ]; repliestoyes = [ "Okay", "Yes received", "Alright", "No" ]; whorureplies = [ "My name is ScriptAI, I'm here to help!", "I'm a virtual assistant created by TR. My name is ScriptAI.", "Hi, I'm ScriptAI!", "My name is ScriptAI" ]; //Message reception & response system if(!commandinput.value.includes("say") && !commandinput.value.includes("tweet")){ if(commandinput.value.includes("donate")){ commandoutput.value = "..."; window.open("https://paypal.me/tylerruotolo"); } else if(commandinput.value == ""){ commandoutput.value = "..."; } else if(commandinput.value == "yes"){ commandoutput.value = repliestoyes[Math.floor(Math.random() * repliestoyes.length)]; } else if(commandinput.value.includes("your name") || commandinput.value.includes("who are you")){ commandoutput.value = whorureplies[Math.floor(Math.random() * whorureplies.length)]; } else if(commandinput.value.includes("random number")){ commandoutput.value = Math.floor((Math.random() * 100) + 1); } else if(commandinput.value.includes("dice") || commandinput.value.includes("roll the dice")){ commandoutput.value = Math.floor((Math.random() * 6) + 1); } else if(commandinput.value.includes("version")){ commandoutput.value = version; } } for(var i = 0; i < weatherpromt.length; i++){ if(commandinput.value.includes(weatherpromt[i])){ commandoutput.value = "Here's the " + weatherpromt[i] + " for today..."; window.open("https://duckduckgo.com/?q=weather"); } } for(var i = 0; i < question.length; i++){ if(commandinput.value.includes(question[i])&& !commandinput.value.includes('version') && !commandinput.value.includes("time") && !commandinput.value.includes("the time") && !commandinput.value.includes("date") && !commandinput.value.includes("day") && !commandinput.value.includes("you") && !commandinput.value.includes("say") && !commandinput.value.includes("weather")){ commandoutput.value = "Searching the web for '" + commandinput.value + "'"; window.open("https://duckduckgo.com/?q=" + commandinput.value); } } for(var i = 0; i < greetings.length; i++){ if(commandinput.value.includes(greetings[i]) && !commandinput.value.includes("this") && !commandinput.value.includes("shit") && !commandinput.value.includes("something") && !commandinput.value.includes("say")){ commandoutput.value = greetingreplies[Math.floor(Math.random() * greetingreplies.length)]; } } for(var i = 0; i < hruprompt.length; i++){ if(commandinput.value.includes(hruprompt[i])){ commandoutput.value = hrureplies[Math.floor(Math.random() * hrureplies.length)]; } } for(var i = 0; i < swears.length; i++){ if(commandinput.value .includes(swears[i]) && !commandinput.value.includes("say")){ commandoutput.value = swearreplies[Math.floor(Math.random() * swearreplies.length)]; } } if(commandinput.value.includes("say") && !commandinput.value.includes("funny") && !commandinput.value.includes("joke")){ commandoutput.value = commandinput.value.replace("say", ""); } for(var i = 0; i < jokeprompt.length; i++){ if(commandinput.value.includes(jokeprompt[i])){ commandoutput.value = jokes[Math.floor(Math.random() * jokes.length)]; } } for(var i = 0; i < datetime.length; i++){ if(commandinput.value.includes(datetime[i]) && !commandinput.value.includes(weatherpromt[i]) && !commandinput.value.includes("how are you") && !commandinput.value.includes("weather")){ let currentDate = new Date(); let cDay = currentDate.getDate(); let cMonth = currentDate.getMonth() + 1; let cYear = currentDate.getFullYear(); let cHour = currentDate.getHours() let cMin = currentDate.getMinutes(); var ampm; if(cHour >= 13){ cHour = currentDate.getHours() - 12; ampm = "PM"; } else if(cHour <= 13){ cHour = currentDate.getHours(); ampm = "AM"; } else if(cHour <= 0){ cHour = 12; } if(cMin <= 9){ cMin = "0" + currentDate.getMinutes(); } else if(cMin >= 9){ cMin = currentDate.getMinutes(); } var cTime = cHour + ":" + cMin + " " + ampm; var months = [ " ", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ] commandoutput.value = "It is currently " + months[cMonth] + " " + cDay + ", " + cYear + " at " + cTime; } } /*for(var i = 0; i < websiteprompt.length; i++){ if(commandinput.value.includes(websiteprompt[i])){ var link = commandinput.value.replace(websiteprompt[i], "https://www."); window.open(link); } }*/ if(commandinput.value.includes("tweet")){ var tweet = commandinput.value.replace("tweet", ""); commandoutput.value = "Posting" + '"' + tweet + '"'; window.open('https://twitter.com/intent/tweet?text=' + tweet); } //Voice & TTS system var available_voices = window.speechSynthesis.getVoices(); var english_voice = ''; for(var i=0; i