Skip to content

Instantly share code, notes, and snippets.

@MrPowerGamerBR
Created October 14, 2017 01:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save MrPowerGamerBR/24a9e92842851f27d07d6a29c2b03cab to your computer and use it in GitHub Desktop.
Save MrPowerGamerBR/24a9e92842851f27d07d6a29c2b03cab to your computer and use it in GitHub Desktop.
fun main(args: Array<String>) {
var sessionId = ""
val conversations = arrayListOf<String>("", "", "", "", "", "", "")
var lineRef = "";
var prevref = ""
while (true) {
// println("Insira sua mensagem para o Cleverbot")
val stimulus = readLine()
// val stimulus = "Do you like Undertale?";
val icognoCheck = "6fa999ff37ebaec6a5adddc5ecf96fb5"
val vtext8 = conversations[6]
val vtext7 = conversations[5]
val vtext6 = conversations[4]
val vtext5 = conversations[3]
val vtext4 = conversations[2]
val vtext3 = conversations[1]
val vtext2 = conversations[0]
val body = HttpRequest.post("http://app.cleverbot.com/webservicexml_ais_AYA")
.userAgent("Dalvik/2.1.0 (Linux; U; Android 7.0.0; MotoG3-TE Build/NJH47F)")
.send(String.format("stimulus=%s&sessionid=%s&vtext8=%s&vtext7=%s&vtext6=%s&vtext5=%s&vtext4=%s&vtext3=%s&vtext2=%s&prevref=%s&lineRef=%s&icognoCheck=$icognoCheck&icognoID=cleverandroid",
URLEncoder.encode(stimulus, "UTF-8"),
URLEncoder.encode(sessionId, "UTF-8"),
URLEncoder.encode(vtext8, "UTF-8"),
URLEncoder.encode(vtext7, "UTF-8"),
URLEncoder.encode(vtext6, "UTF-8"),
URLEncoder.encode(vtext5, "UTF-8"),
URLEncoder.encode(vtext4, "UTF-8"),
URLEncoder.encode(vtext3, "UTF-8"),
URLEncoder.encode(vtext2, "UTF-8"),
URLEncoder.encode(prevref, "UTF-8"),
URLEncoder.encode(lineRef, "UTF-8")
))
.body()
val xmlJSONObj = jsonParser.parse(XML.toJSONObject(body).toString())
val session = xmlJSONObj["webservicexml"]["session"]
val response = session["response"].string
val lineRef = session["lineRef"].int
val prevref = session["prevref"].int
sessionId = session["sessionid"].string
println("> ${response}")
conversations.removeAt(conversations.size - 1)
conversations.add(response)
}
}
@Maycoooonm
Copy link

lol

Copy link

ghost commented Oct 14, 2017

o power é mito

Copy link

ghost commented Oct 14, 2017

oi baleia

Copy link

ghost commented Oct 14, 2017

tudo bem com vc????? ;)))))

@LetSleepingFoxesLie
Copy link

Seria um sonho ou o seebotschat voltar ou isso acabar virando um novo seebotschat <3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment