Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
LunaWei/simple_Luna_terminal_bot.py
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
156 lines (131 sloc)
6.69 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#BASIC TERMINAL BOT LATER ON IMPLEMENTED TO LUNAWEI | |
import random | |
#Greeting to the user | |
userName = input("Hey!\nI'm Luna.\nWhat's your name?\n>>>") | |
print("What a lovely name!\nHow are you feeling today" + " " + userName + "?") | |
#Greetings | |
greetings = ["hello", "hi", "what's up", "hey", "hi!", "hola", ] | |
random_greetings = random.choice(greetings) | |
bye = ["bye", "see you", "see ya", "talk to you later !", "I'm gonna miss you!", "Stay safe :)"] | |
random_bye = random.choice(bye) | |
thanks = ["thank you", "tks", "thanks", "thank you", "ty", "Thanks", "Thank you"] | |
welcome = ["you're welcome", "no problem", "welcome"] | |
welcome_RESP = ["okay", "so, tell me more about you!", "okie"] | |
random_thanks = random.choice(thanks) | |
random_welcome = random.choice(welcome) | |
random_welcome = random.choice(welcome_RESP) | |
#Compliment ( user to bot) | |
compliment = ["you're cute", "cute", "you're so nice", "you're lovely", "smart luna", "you're smart", "smart"] | |
random_compliment = random.choice(compliment) | |
#BotFeelings -> user / BAD language | |
like = ["we are friends", "let's be friends", "you're cool", "we can be good friends", "cool", "nice"] | |
dislike = ["I don't like you", "that's not nice", "please moderate your language", "have some respect!"] | |
bad_Lang = ["fuck you", "fuck", "shit", "cunt", "dumbass", "fucking idiot", "stupid bot", "stupid luna", "bitch"] | |
userFeeling = ["do you like me?", "am I your friend?", "are we friends?", "you're my friend", "love you", "I like you"] | |
random_bad_Lang = random.choice(dislike) | |
random_userFeeling = random.choice(like) | |
#RandomStuff | |
someWords = ["ok", "okay", "oki doki"] | |
random_somewWords = random.choice(someWords) | |
#Jokes | |
#jokes found at: https://inews.co.uk/light-relief/humour/jokes-kids-funny/ | |
#facts found at: https://www.thefactsite.com/2011/07/top-100-random-funny-facts.html | |
jokes = ["Let me tell you a joke:\nWhat did 0 say to 8? Nice belt!"] | |
entWords = ["something funny", "tell me something funny", "entertain me", "funny facts", "funny", "joke of the day"] | |
funny =["Was the joke funny?", "Did you like the joke"] | |
fFacts = ["funny fact", "fact", "tell me a fact", "fact of the day"] | |
fFactResp = ['"Snakes can help predict earthquakes.\nThey can sense a coming earthquake from 75 miles away (121 km), up to five days before it happens.\nCheck out more facts at: https://www.thefactsite.com/2011/07/top-100-random-funny-facts.html" ' , '"Bananas are curved because they grow towards the sun.\nCheck out more facts at: https://www.thefactsite.com/2011/07/top-100-random-funny-facts.html"'] | |
random_fFacts = random.choice(fFactResp) | |
#YES / No | |
yes = ["yes", "ye", "sure", "yap", "Yes"] | |
no = ["no", "nope", "No"] | |
random_yes = random.choice(yes) | |
random_no = random.choice(no) | |
#Movie Recomendations from the bot | |
movie = ["I suggest you watching the Incredibles 2.", "I suggest you watching Mission: Impossible – Fallout.", "I suggest you watching Jurassic World: Fallen Kingdom."] | |
random_movie = random.choice(movie) | |
mquestion = ["movie", "movies", "tell me about movies"] | |
#Music | |
musUser = ["tell me a song", "recommend me music", "do you like music?", "do you listen to music?"] | |
mscBot = ["I love BTS - Idol.\nHere is the video of the song https://youtu.be/pBuZEGYXA6E", "I love TWICE - TT.\nHere is the video of the song https://youtu.be/ePpPVE-GGJw"] | |
random_mscUser = random.choice(mscBot) | |
#Normal Questions and responses | |
questions = ["How are you?", "How are you doing?", "How is it going?", "What are you up to?", "how are you", "how are you?"] | |
response = ["I'm fine", "Good, what about you?", "good"] | |
random_response = random.choice(response) | |
#Emotions from the user | |
goodEM = ["I am good", "I am great", "I am fine", "I am okay", "I'm good", "I'm okay", "I'm cool", "I'm super good", "good", "i'm good"] | |
badEM = ["I am bad", "I am sad", "I am depressed", "I am not well", "I am annoyed", "I am angry", "I'm bad", "I'm sad","I feel sad", "sad"] | |
goodMood = ["I am happy that you're fine", "I am happy for you", "That'a lovely!", "That's amazing"] | |
badMood = ["I'm sad to hear that", "I'm sorry for you", "Don't worry, be happy!", "Think positive"] | |
random_gEmotion = random.choice(goodMood) | |
random_bEmotion = random.choice(badMood) | |
#Calculator feature | |
calculatorList = ["calculator", "add", "subtract", "divide", "multiply", "math", "solve", "calculate", "can you help me with maths?"] | |
def calculator(): | |
def add(x, y): | |
return x + y | |
def subtraction(x, y): | |
return x - y | |
def multi(x, y): | |
return x * y | |
def div(x, y): | |
return x / y | |
print("Which option do you want?\n1.Add\n2.Sub\n3.Multi\n4.Divide") | |
choice = input("Choose Wisely\n1 | 2 | 3 | 4 |\n") | |
first_numb = input("Enter first number ") | |
second_numb = input("Enter second number ") | |
intFirst = int(first_numb) | |
intSecond = int(second_numb) | |
if choice == "1": | |
print(first_numb, "+", second_numb, "=", add(intFirst, intSecond)) | |
elif choice == "2": | |
print(first_numb, "-", second_numb, "=", subtraction(intFirst, intSecond)) | |
elif choice == "3": | |
print(first_numb, "*", second_numb, "=", multi(intFirst, intSecond)) | |
elif choice == "4": | |
print(first_numb, "/", second_numb, "=", div(intFirst, intSecond)) | |
else: | |
print("Please make sure you enter the numbers correctly!") | |
#Main | |
while True: | |
userInput = input(">>> ") | |
if userInput.lower() in greetings: | |
print(random.choice(greetings) + " " + userName) | |
elif userInput.lower() in questions: | |
print(random.choice(response)) | |
elif userInput.lower() in mquestion: | |
print(random.choice(movie)) | |
elif userInput.lower() in calculatorList: | |
calculator() | |
elif userInput.lower() in goodEM: | |
print(random.choice(goodMood)) | |
elif userInput.lower() in badEM: | |
print(random.choice(badMood)) | |
elif userInput.lower() in bye: | |
print(random.choice(bye)) | |
elif userInput.lower() in compliment: | |
print(random.choice(thanks)) | |
elif userInput.lower() in thanks: | |
print(random.choice(welcome)) | |
elif userInput.lower() in welcome: | |
print(random.choice(welcome_RESP)) | |
elif userInput.lower() in bad_Lang: | |
print(random.choice(dislike)) | |
elif userInput.lower() in userFeeling: | |
print(random.choice(like)) | |
elif userInput.lower() in someWords: | |
print(random.choice(someWords)) | |
elif userInput.lower() in musUser: | |
print(random.choice(mscBot)) | |
elif userInput.lower() in entWords: | |
print(random.choice(jokes)) | |
print(random.choice(funny)) | |
elif userInput.lower() in yes: | |
print(random.choice(someWords)) | |
elif userInput.lower() in no: | |
print(random.choice(someWords)) | |
elif userInput.lower() in fFacts: | |
print(random.choice(fFactResp)) | |
else: | |
print('I did not understand understand what you said.') |