Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Termination whitelist
- local admin = {
- ["Gonow32"] = true,
- ["fun_ride"] = true,
- }
- os.loadAPI("go")
- function terminating()
- while true do
- if event == "terminate" then
- term.clear()
- term.setCursorPos(1,1)
- print("Click the player detector to terminate.")
- local evt, player = os.pullEvent("player")
- if admins[player] then
- say("An admin has terminated CubeBot!")
- break
- end
- break
- else
- printError("You are not admin!")
- say("Warning! "..player.." tried to terminate CubeBot!")
- end
- end
- end
- end
- function main()
- term.clear()
- term.setCursorPos(1,1)
- print("Gonow32 Personality Set")
- function say(str)
- s = str:gsub("&","\194\167")
- peripheral.find("command").setCommand("say "..s)
- peripheral.find("command").runCommand()
- end
- say("Gonow32 Personality Test (&4Cube&bBot&d) online!")
- cb = peripheral.find("chatbox")
- go.runDispatcher( terminating() )
- while true do
- local e = {os.pullEvent("chat_message")}
- msg = e[4]
- if msg:sub(1,9) == "CubeBot, " then
- if fs.exists("/questions/"..msg:gsub("CubeBot, ","")) then
- say(fs.open("/questions/"..msg:gsub("CubeBot, ",""),"r").readAll())
- end
- end
- end
- local ok, err = pcall( main )
- if not ok then
- say("Oh noes! D: Looks like I had an error!")
- say("&c"..err)
- f = fs.open("/errorlog","a")
- errortime = textutils.formatTime( os.time(), false )
- f.writeLine("Error: Time: "..errortime.." Error: "..err)
- f.close()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement