slack には cron のようなリマインダー機能がある。こいつを登録しておく事で、定期的に slackbot が
Reminder: @name 登録メッセージ...
といった発言をさせることが出来る。
Ruboty に反応させたい
Ruboty は標準の正規表現では、上記メッセージに反応しない。
実装は固定で
module Ruboty
class Action
def self.prefix_pattern(robot_name)
/\A@?#{Regexp.escape(robot_name)}:?\s+/
end
となっているので、それらを変えてしまう。(-l でロード時のスクリプトに追加等々)
require 'ruboty/action'
module Ruboty
class Action
def self.prefix_pattern(robot_name)
/(?:\A|\s)@?#{Regexp.escape(robot_name)}:?\s+/
end
end
end
これで Reminder: @name xxx
に反応する。
綺麗なやり方
場当たり的な方法じゃ無く、ちゃんとしたAPIを作ってPRを送ろう!