class Cogibara::Responder
Public Instance Methods
redis()
click to toggle source
# File lib/cogibara/responder.rb, line 5 def redis @redis ||= Redis.new end
send_reply(message, client, options={type: "text"})
click to toggle source
# File lib/cogibara/responder.rb, line 9 def send_reply(message, client, options={type: "text"}) if(Cogibara::config.use_redis) redis.multi do redis.incr "sendMsgNum" @msgid = redis.get "sendMsgNum" end redis.hmset("sendMsg:#{@msgid.value}",options[:type],message,"client",client) redis.publish("fromCapy","sendMsg:#{@msgid.value}") end if(Cogibara::config.local) puts message unless message[0] == "@" end end