def setupClarissa(install_path): useWebServices() os.remove("setup.ini") if (os.path.isfile("setup.ini")): out = open('setup.ini', 'a') del_settings = input( "This will delete your current settings. Do you wish to continue? (Y/N)" ) if "y" in del_settings.lower(): os.remove("rm -R Settings") os.mkdir("Settings") else: exit() else: if not os.path.exists(install_path + "/Settings"): os.mkdir(install_path + "/Settings") out = open('setup.ini', 'w') print("Setting up Clarissa. This should not take long.") setup = open(os.environ['USERPROFILE'] + "/._clarissa.py", 'w') setup.write("import os\n") setup.write("os.environ['CLARISSA_PATH']=r\"" + install_path + "\"") setup.flush() setup.close() os.environ['CLARISSA_PATH'] = install_path w.setClarissaSettingWithPath("setup.ini", "main", "install", install_path) w.setClarissaSetting("main", "auto_update", "true") w.setClarissaSetting("speech", "hey_clarissa_enabled", "false") w.setClarissaSetting("speech", "speak_out", "false") w.setClarissaSetting("main", "user.name", input("Your username: "******"chatterbot.corpus.english") os.system("pip install -r TO_INSTALL.txt")
def getStatus(url): with open(url, "r") as f: j = json.load(f) text = "" for line in range(len(j)): if (j[line]["status"] == "OKAY"): w.setClarissaSettingWithPath("user.ini", "user", "user", j[line]["username"]) w.setClarissaSettingWithPath("user.ini", "pass", "pass", j[line]["password"]) else: print("You entered either a wrong username or password")
elif ("--get-commands" in sys.argv): commandsList = open("commands.list", "r") print(commandsList.read()) elif ("--update-clarissa" in sys.argv): os.system("python update.py") elif ("--get-logs" in sys.argv): logs = open('chat.log', 'r') print(logs.read()) elif (sys.argv[1] == "set.name"): w.setClarissaSetting("user.name", sys.argv[2]) elif (sys.argv[1] == "--get-setting"): print(getClarissaSetting(sys.argv[2])) elif (sys.argv[1] == "--update-from-url"): os.system("python update.py --from-url " + sys.argv[2]) elif ("--enable-auto-update" in sys.argv): w.setClarissaSettingWithPath("Settings/update.settings", "Clarissa.AUTO_UPDATE", "true") elif ("--update-bot" in sys.argv): os.system("python update.py") elif ("--help" in sys.argv or "--h" in sys.argv): print("Commands:") print("\t--add-command : Adds command to Clarissa") print("\t--clear-commands : Clears all added custom commands") print("\t--get-commands : Prints a list of Clarissa commands") print("\t--update-clarissa : Adds messages") print("\t--get-logs : Gets all the chat logs") print("\tset.name : Gives you a custom username") print("\t--get-setting: Gets settings stored") print( "\t--enable-auto-update : Turns on auto update feature for commands" ) print(
import writer as w import sys if(sys.argv[1] == "--translate-to"): w.setClarissaSettingWithPath("Settings/translate.setting","language", "to", sys.argv[2])
commandsList = open("commands.list", "r") print(commandsList.read()) elif ("--update-clarissa" in sys.argv): os.system("python update.py") print("Clarissa: Updating won't work just yet.") elif ("--get-logs" in sys.argv): logs = open('chat.log', 'r') print(logs.read()) elif (sys.argv[1] == "set.name"): w.setClarissaSetting("main", "user.name", sys.argv[2]) elif (sys.argv[1] == "--get-setting"): print(getClarissaSetting("main", sys.argv[2])) elif (sys.argv[1] == "--update-from-url"): os.system("python update.py --from-url " + sys.argv[2]) elif ("--enable-auto-update" in sys.argv): w.setClarissaSettingWithPath("Settings/Clarissa.ini", "update", "Clarissa.AUTO_UPDATE", "true") elif ("--update-bot" in sys.argv): os.system("python update.py") elif (sys.argv[1] == "--set-setting"): w.setClarissaSetting(sys.argv[2], sys.argv[3], sys.argv[4]) elif ("--enable-speech-recognition" in sys.argv): w.setClarissaSetting("speech", "hey_clarissa_enabled", "true") elif ("--disable-speech-recognition" in sys.argv): w.setClarissaSetting("speech", "hey_clarissa_enabled", "false") elif ("--speak-out" in sys.argv): w.setClarissaSetting("speech", "speak_out", "true") elif ("--disable-speak-out" in sys.argv): w.setClarissaSetting("speech", "speak_out", "false") elif ("--retrain" in sys.argv): cb = ChatBot('Clarissa', trainer='chatterbot.trainers.ChatterBotCorpusTrainer')