LoginSignup
0
1

More than 5 years have passed since last update.

RubotyのRocket.Chatアダプターを書くメモ

Last updated at Posted at 2017-07-07

はじめに

Rocket.Chatをよく使う。
ChatといえばBotでBotといえばHubotだけどcoffeescript好きくない

coffeescriptよりRubyのほうが好きなので探したらRobotyに行き着いた。
RobotyいいけどRocket.Chatアダプターがない。
なので書く。けどRuby詳しくないので色々調べながらの作業

最初わからなかったこと

  • Bundler
  • Rocket.Chat API
  • Rocket.Chat TestServer構築
  • Adapterのテスト
  • module

わかったこと

Bundler

gemがRubyのプラグインで、Bundlerはプラグイン管理
http://qiita.com/oshou/items/6283c2315dc7dd244aef

Rubotyはgemで自作AdapterもgemなのでBundler経由で作ると楽そう

初回環境構築は

bundler gem ruboty-rocketchat

Rocket.Chat API

Rocket.Chatから発言を拾うため本家から繋ぎ方を調べる。
https://rocket.chat/docs
https://rocket.chat/docs/developer-guides/rest-api
まだβ版らしい。

REST APIに対応したgemもあるが発言は未対応っぽい
https://github.com/abrom/rocketchat-ruby

REST APIで発言を抜くのはあれっぽい。
非公開APIだけどREALTIME API使うとよさげ
https://rocket.chat/docs/developer-guides/realtime-api

hubotは公式がAdapterを公開してるので、Adapterソースを見てみる
https://github.com/RocketChat/hubot-rocketchat/blob/master/src/rocketchat_driver.coffee

MeteoraとかAsteroidはよくわからないけど、websocketでsubscribeしてchangeを受け取れば良い気がする。

まだ調べ中

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1