File tree 2 files changed +25
-1
lines changed
2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change 103
103
}
104
104
105
105
config . plugins . options [ Cinch ::TwitterWebhooks ] = {
106
+ :user => "EasyRPG" ,
106
107
:secret => $secrets[ "twitter_hooks" ] [ "secret" ]
107
108
}
108
109
Original file line number Diff line number Diff line change @@ -43,8 +43,31 @@ class Cinch::TwitterWebhooks
43
43
44
44
when "mention"
45
45
46
- template = "New tweet by %s (https://twitter.com/%s/status/%s):"
46
+ # FIXME: all fields sent by zapier are strings
47
+
48
+ # ignore normal retweets
49
+ retweet = data [ "retweet_count" ]
50
+ halt 202 if retweet != "0"
51
+
52
+ type = "tweet"
53
+
54
+ # retweet with added message
55
+ type = "quoted tweet" if data [ "is_quote" ] == "True"
56
+
57
+ if data . has_key? ( 'in_reply_to' )
58
+
59
+ type = "tweet in conversation"
60
+
61
+ # replied to us?
62
+ if data [ "in_reply_to" ] == bot . config . plugins . options [ Cinch ::TwitterWebhooks ] [ :user ]
63
+ type = "reply"
64
+ end
65
+
66
+ end
67
+
68
+ template = "New %s by %s (https://twitter.com/%s/status/%s):"
47
69
message = sprintf ( template ,
70
+ type ,
48
71
data [ "name" ] ,
49
72
user ,
50
73
data [ "id" ] )
You can’t perform that action at this time.
0 commit comments