public
Description: An extensible bot for the Campfire web-based chat system #crc
Homepage:
Clone URL: git://github.com/timriley/campfire-bot.git
provide an option to hide replies or not in the twitter echo plugin, instead of 
just hiding them by default
timriley (author)
Wed Oct 29 06:25:50 -0700 2008
commit  c08814cbaeb7a60c9003c1955765f700258c435e
tree    0abb7a7be4e42422c2c40c9fa358b811974cec96
parent  4e91bf8d2ebeee2d1b64f7693a468b5d154a986a
...
5
6
7
 
8
9
10
11
12
13
14
15
 
 
16
...
5
6
7
8
9
10
11
12
13
14
 
15
16
17
18
0
@@ -5,10 +5,12 @@ development:
0
   nickname: Bot Name
0
   password: password
0
   twitter_feed: 'http://search.twitter.com/search.atom?q=from%3Atimriley+OR+from%3Ahughevans+OR+from%3Aschlick+OR+from%3Aseanodowd'
0
+  twitter_hide_replies: false
0
 production:
0
   site: campfire_subdomain_name
0
   room: Company Chat
0
   username: foo@bar.com
0
   nickname: Bot Name
0
   password: password
0
-  twitter_feed: 'http://search.twitter.com/search.atom?q=from%3Atimriley+OR+from%3Ahughevans+OR+from%3Aschlick+OR+from%3Aseanodowd'
0
\ No newline at end of file
0
+  twitter_feed: 'http://search.twitter.com/search.atom?q=from%3Atimriley+OR+from%3Ahughevans+OR+from%3Aschlick+OR+from%3Aseanodowd'
0
+  twitter_hide_replies: false
0
\ No newline at end of file
...
12
13
14
15
16
 
 
 
 
17
18
19
20
21
 
22
23
24
...
12
13
14
 
 
15
16
17
18
19
20
21
22
 
23
24
25
26
0
@@ -12,13 +12,15 @@ class TwitterEcho < CampfireBot::Plugin
0
   at_interval 2.minutes, :echo_tweets
0
   
0
   def initialize
0
-    @feed   = CampfireBot::Bot.instance.config['twitter_feed']
0
-    @latest = Time.now
0
+    @feed         = CampfireBot::Bot.instance.config['twitter_feed']
0
+    @hide_replies = CampfireBot::Bot.instance.config.key?('twitter_hide_replies') ?
0
+                      CampfireBot::Bot.instance.config['twitter_hide_replies'] : false
0
+    @latest       = Time.now
0
   end
0
   
0
   def echo_tweets(msg = nil)
0
     recent_tweets.reverse.each do |tweet|
0
-      speak("#{coder.decode(tweet.from)}: #{coder.decode(tweet.text)} #{tweet.link}") unless tweet.text =~ /^@/
0
+      speak("#{coder.decode(tweet.from)}: #{coder.decode(tweet.text)} #{tweet.link}") unless (tweet.text =~ /^@/ && @hide_replies)
0
     end
0
     @latest = latest_tweet.date   # next time, only print tweets newer than this
0
     @doc    = nil                 # reset the feed so that next time we can actually any new tweets

Comments