Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- If MineCraft chat is used while in range of the chatbox, cleverbot will respond to you.
- -- Should be able to hold a different conversation with each player in the area.
- local boxName = "TheGhost"
- os.loadAPI("cleverbot") -- http://www.computercraft.info/forums2/index.php?/topic/22355-cleverbot-client-in-pure-lua-up-to-date
- local chatbox = peripheral.find("chatbox") -- http://moarperipherals.com/index.php?title=ChatBox
- chatbox.setLabel(boxName)
- local chatSession = {}
- while true do
- local myEvent = {os.pullEvent("chat_message")}
- if not chatSession[myEvent[3]] then chatSession[myEvent[3]] = cleverbot.Cleverbot.new() end
- local response = chatSession[myEvent[3]]:send(myEvent[4])
- chatbox.tell(myEvent[3], response)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement