Created
November 11, 2013 00:11
-
-
Save boxp/7405729 to your computer and use it in GitHub Desktop.
GrimoireでGrowlに通知を送るプラグイン
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
(do | |
(require '[gntp :as gp] | |
'[clojure.java.io :as io]) | |
(let [growler (gp/make-growler "Grimoire") | |
notifier (if (try (.. @main-stage isShowing) | |
(catch Exception e nil)) | |
(fn [& _] nil) | |
(growler :default {:icon (io/input-stream (io/resource "alice.png"))}))] | |
(reify Plugin | |
(get-name [this] nil) | |
(on-status [this status] | |
(cond | |
(.. status isRetweet) | |
((:default notifier) (str "@" (.. status getRetweetedStatus getUser getScreenName)) | |
:text (.. status getRetweetedStatus getText) | |
:icon (io/input-stream (.. status getRetweetedStatus getUser getBiggerProfileImageURL))) | |
:else | |
((:default notifier) (str "@" (.. status getUser getScreenName)) | |
:text (.. status getText) | |
:icon (io/input-stream (.. status getUser getBiggerProfileImageURL))))) | |
(on-rt [this status] | |
((:default notifier) (str "@" (.. status gerUser getScreenName) " にリツイートされました!") | |
:text (.. status getRetweetedStatus getText) | |
:icon (io/input-stream (.. status getRetweetedStatus getUser getBiggerProfileImageURL)))) | |
(on-unrt [this status] | |
((:default notifier) (str "@" (.. status getUser getScreenName) " にリツイートを取り消されました!") | |
:text (.. status getRetweetedStatus getText) | |
:icon (io/input-stream (.. status getRetweetedStatus getUser getBiggerProfileImageURL)))) | |
(on-fav [this source target status] | |
((:default notifier) (str "@" (.. source getScreenName) " にふぁぼられました!") | |
:text (.. status getText) | |
:icon (io/input-stream (.. status getUser getBiggerProfileImageURL)))) | |
(on-unfav [this source target status] | |
((:default notifier) (str "@" (.. source getScreenName) " にあんふぁぼされました!") | |
:text (.. status getText) | |
:icon (io/input-stream (.. status getUser getBiggerProfileImageURL)))) | |
(on-del [this status] nil) | |
(on-follow [this source user] | |
((:default notifier) (str "@" (.. source getScreenName) " にフォローされました!") | |
:text (.. source getDescription) | |
:icon (io/input-stream (.. source getBiggerProfileImageURL)))) | |
(on-dm [this dm] | |
((:default notifier) (str "@" (.. dm getSenderScreenName) " からDMを受信しました!") | |
:text (.. dm getText) | |
:icon (io/input-stream (.. dm getSender getBiggerProfileImageURL)))) | |
(on-start [this] nil) | |
(on-click [this e])))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment