Sha256: d99660dd9e9e75b8f3b9d39b3732289f2cb4820a10bb5b330b3526ae8b9a68f4

Contents?: true

Size: 731 Bytes

Versions: 1

Compression:

Stored size: 731 Bytes

Contents

$LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../lib"

require 'rubygems'
require 'protolink'
require 'linkbot/base_plugins'

# require 'ruby-debug'
# Debugger.start

# from https://github.com/markolson/linkbot
Linkbot::Plugin.collect

# change this if you need to connect to another server
PTN_SERVER = "http://localhost:3000"
PTN_USER   = "admin"
PTN_PASS   = "admin"
protonet = Protolink::Protonet.open(PTN_SERVER, PTN_USER, PTN_PASS)
protonet.socket do |json|
  response = Linkbot::Plugin.handle_message(Message.new(json["message"], json["user_id"], json["author"], :message)) if json["trigger"] == "meep.receive"
  unless response.blank?
    c = protonet.find_channel(json["channel_id"])
    c.speak(response.first)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
protolink-0.2.8 example/chatbot.rb