Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local args = {...}
- local heart = "\x03"
- local hist = {}
- local f = fs.open("mommy_config.json","r")
- local text = f.readAll()
- local config = textutils.unserialiseJSON(text)
- f.close()
- config.emoji = string.char(config.emoji)
- local function choice(t)
- return t[math.random(1,#t)]
- end
- local function fill(s)
- strconfig = {
- ["emoji"]=config.emoji,
- ["affectionate_term"]=choice(config.affectionate_terms),
- ["role"]=choice(config.roles),
- ["pronoun"]=choice(config.pronouns)
- }
- for i,v in pairs(strconfig) do
- s = string.gsub(s, "{"..i.."}", v)
- end
- return s
- end
- local function respond(r)
- term.setBackgroundColor(colors.black)
- term.setTextColor(config.color)
- if r then
- if not config.only_negative then
- print(fill(choice(config.positive_responses)))
- end
- else
- print(fill(choice(config.negative_responses)))
- end
- end
- if #args>0 then
- if fs.isDir(args[1]) then
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.yellow)
- term.clear()
- term.setCursorPos(1,1)
- print(os.version())
- shell.exit()
- else
- respond(shell.execute(table.unpack(args)))
- return
- end
- end
- while true do
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.yellow)
- write(heart.." "..shell.dir().."> ")
- term.setTextColor(colors.white)
- hist[#hist+1]=read(nil,hist,shell.complete)
- respond(shell.run(hist[#hist]))
- end
Advertisement
Add Comment
Please, Sign In to add comment