0

I'm trying to make a table of values inside hubot and he pass it's values to redis-brain.coffee but i just know a way: robot.brain.get("blablabla"). This will get a string from redis-brain and i need some kind of table.

How I'll use it: At first call of this function, hubot will load the full database to the memory, then, if there's

  robot.catchAll (msg) ->
if not quiet
  text = msg.message.text
  ector.setUser msg.message.user.name
  if not loaded_brain
    ector_brain = robot.brain.get('ector_brain') #need to be some type of table - In mysql should be like a select
    ector.addEntry ector_brain
    loaded_brain = true
  else
    ector.addEntry text
    ector_brain = ector_brain+text #this line should insert the value of text inside ector_brain table. -- In mysql shoud be like an insert into
  ector.linkNodesToLastSentence previousResponseNodes
  response = ector.generateResponse()
  previousResponseNodes = response.nodes
  msg.reply response.sentence

So, how do I create a table in redis from hubot?

4

1 回答 1

1

robot.brain.getrobot.brain.set使用 JSON 对象进行操作,而不仅仅是字符串。只需将具有您选择的数据结构的对象放在大脑中,并在必要时将其取回。

于 2014-08-06T05:17:18.760 回答