Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

28 lines (20 sloc) 0.655 kb
Url = require 'url'
Redis = require 'redis'
module.exports = (robot) ->
info = 'redis://localhost:6379'
client = Redis.createClient(info.port, info.hostname)
if info.auth
client.auth info.auth.split(":")[1]
client.on "error", (err) ->
robot.logger.error err
client.on "connect", ->
robot.logger.info "Successfully connected to Redis"
client.get "hubot:storage", (err, reply) ->
if err
throw err
else if reply
robot.brain.mergeData JSON.parse(reply.toString())
robot.brain.on 'save', (data) ->
client.set 'hubot:storage', JSON.stringify data
robot.brain.on 'close', ->
client.quit()
Jump to Line
Something went wrong with that request. Please try again.