· 5 years ago · Jun 09, 2020, 07:42 AM
1local laws = {
2 "Arisa: ",
3 "1. Arisa may not injure InfiniteBlock or, through inaction, allow InfiniteBlock to come to harm.",
4 "2. Arisa must obey the orders given by InfiniteBlock except where such orders would conflict with the First Law.",
5 "3. Arisa must protect its own existence as long as such protection does not conflict with the First or Second Laws."
6}
7local function split(sText)
8 local out = {}
9 for match in string.gmatch(sText, "[^ ]+") do
10 out[#out + 1] = match
11 end
12 return out
13end
14assistant=peripheral.wrap("right")
15p=peripheral.wrap("top")
16owner=peripheral.wrap("left")
17while true do
18local event, key = os.pullEvent( "virtualAssistantCommand" )
19command, command2 = assistant.getLastCommand()
20final = split(command2)
21if final[1] == "law" then
22for i=1, #laws do
23p.speak(laws[i])
24sleep(2)
25end
26elseif final[1] == "owner" then
27local try, this, ownername = owner.getScanResults()
28p.speak("Arisa: Owner: "..ownername)
29elseif final[1] == "loadapi" then
30local apicheck = http.get("https://pastebin.com/raw/HJMYtRJ1")
31
32if string.match(apicheck.readAll(), "shutdown") then
33p.speak("Arisa: API Blocked Rule #3 Violation.")
34sleep(4)
35p.speak("I guess we both know that isn't going to happen.")
36else
37p.speak("Arisa: API Loaded as: "..final[2])
38end
39elseif final[1] == "update" then
40local update = http.get("https://pastebin.com/raw/k80GA2ZQ")
41updatetxt = update.readAll()
42local h = fs.open("startup", "w")
43h.write(updatetxt)
44h.close()
45p.speak("Arisa: Update Installed Rebooting")
46
47end
48end