Created
January 24, 2012 08:26
-
-
Save rummelonp/1668835 to your computer and use it in GitHub Desktop.
Creepy から im.kayac.com への通知に tweetbot 用の handler 付けるパッチ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
commit 0370931a794f6b78dfaf0b83b0552bd80bc87f10 | |
Author: Kazuya Takeshima <[email protected]> | |
Date: Tue Jan 24 17:15:36 2012 +0900 | |
Add im.kayac.com handler to tweetbot. | |
diff --git a/config/config.rb b/config/config.rb | |
index a01f03f..f86ca70 100644 | |
--- a/config/config.rb | |
+++ b/config/config.rb | |
@@ -85,7 +85,13 @@ Creepy.configure do |config| | |
## 通知のフォーマット設定 | |
## keyword, status を受け取り [title, message] を返す call メソッドを実装したオブジェクト | |
## 標準は Creepy::Hooks::Keyword::Formatter.default | |
- # keyword.formatter = Creepy::Hooks::Keyword::Formatter.simple | |
+ keyword.formatter = lambda do |keyword, status| | |
+ title, message = Creepy::Hooks::Keyword::Formatter.default.call(keyword, status) | |
+ options = { | |
+ :handler => "tweetbot://#{config.twitter.credentials.screen_name}/status/#{status.id}" | |
+ } | |
+ [title, message, options] | |
+ end | |
## 通知先の設定 | |
## title, message を受け取る call メソッドを実装したオブジェクト | |
diff --git a/lib/creepy/hooks/keyword.rb b/lib/creepy/hooks/keyword.rb | |
index 4460d31..b1a689d 100644 | |
--- a/lib/creepy/hooks/keyword.rb | |
+++ b/lib/creepy/hooks/keyword.rb | |
@@ -20,8 +20,8 @@ module Creepy | |
keyword = $&.to_s | |
return if @exclude.flatten.any? {|k| status.text.match(k)} | |
@hooks.each {|h| h.call(keyword, status)} | |
- title, message = @formatter.call(keyword, status) | |
- @notifies.each {|n| n.call(title, message)} | |
+ title, message, options = @formatter.call(keyword, status) | |
+ @notifies.each {|n| n.call(title, message, options)} | |
end | |
module Formatter |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment