bot_nyan 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -15,3 +15,4 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
+ test.rb
data/README.md CHANGED
@@ -39,12 +39,12 @@ set :access_token, {:token => 'XXXXXX',
39
39
  :secret => 'XXXXXX'}
40
40
  set :name, 'my_bot_name'
41
41
 
42
- on_matched_reply /(^@my_bot_name\s)(Hello)/u do |status, user|
42
+ on_matched_reply /^@my_bot_name\s(Hello)/u do |status, user|
43
43
  reply "@#{user.screen_name} Hello!"
44
44
  end
45
45
 
46
46
  on_replied do |status, user|
47
- reply "@#{user.screen_name} #{status.text}"
47
+ reply "@#{user.screen_name} #{status.text.slice(/^@my_bot_name\s(.*)/u, 1)}"
48
48
  end
49
49
  ```
50
50
 
@@ -14,11 +14,7 @@ module BotNyan
14
14
  module Info
15
15
  def logger_set!(cond)
16
16
  @logger = Logger.new STDOUT
17
- if cond
18
- @logger.level = Logger::DEBUG
19
- else
20
- @logger.level = Logger::INFO
21
- end
17
+ @logger.level = cond ? Logger::DEBUG : Logger::INFO
22
18
  end
23
19
 
24
20
  def info(msg)
@@ -64,11 +60,9 @@ module BotNyan
64
60
  debug event.event
65
61
  if event.text and event.text.match /(^@#{name}\s)/u
66
62
  debug "tweet event"
67
- debug event
68
63
  match? event
69
64
  else
70
- debug 'not tweets'
71
- debug event
65
+ debug 'not reply'
72
66
  end
73
67
  end
74
68
  end
@@ -78,7 +72,7 @@ module BotNyan
78
72
  end
79
73
  end
80
74
  rescue Interrupt
81
- info "\nexitting bot service for @#{name}..."
75
+ info "exitting bot service for @#{name}..."
82
76
  exit 0
83
77
  end
84
78
  end
@@ -91,13 +85,13 @@ module BotNyan
91
85
  get_matched_reply_actions.each do |regexp, block|
92
86
  if event.text.match regexp
93
87
  debug "matched to #{regexp}"
94
- instance_exec event, event.user, &block
88
+ instance_exec &block
95
89
  throw :halt
96
90
  end
97
91
  end
98
92
  if event.text.match(/(^@#{name}\s)/u) and get_relpy_action
99
93
  debug "respond to default reply"
100
- instance_exec event, event.user, &get_relpy_action
94
+ instance_exec &get_relpy_action
101
95
  throw :halt
102
96
  end
103
97
  end
@@ -107,6 +101,10 @@ module BotNyan
107
101
  @wrapper.status
108
102
  end
109
103
 
104
+ def user
105
+ @wrapper.status.user
106
+ end
107
+
110
108
  def update(msg)
111
109
  @wrapper.update msg
112
110
  end
@@ -115,6 +113,10 @@ module BotNyan
115
113
  @wrapper.reply msg
116
114
  end
117
115
 
116
+ alias event status
117
+ alias respond reply
118
+ alias tweet update
119
+
118
120
  # Inner methods that call self.class methods
119
121
  def get_matched_reply_actions
120
122
  self.class.get_matched_reply_actions
@@ -194,12 +196,12 @@ module BotNyan
194
196
  access_tokens[:token],
195
197
  access_tokens[:secret]
196
198
  )
197
- Twitter.configure do |c|
198
- c.consumer_key = consumer_keys[:key]
199
- c.consumer_secret = consumer_keys[:secret]
200
- c.oauth_token = access_tokens[:token]
201
- c.oauth_token_secret = access_tokens[:secret]
202
- end
199
+ @client = Twitter::Client.new(
200
+ :consumer_key => consumer_keys[:key],
201
+ :consumer_secret => consumer_keys[:secret],
202
+ :oauth_token => access_tokens[:token],
203
+ :oauth_token_secret => access_tokens[:secret]
204
+ )
203
205
  @json = nil
204
206
  end
205
207
 
@@ -235,46 +237,33 @@ module BotNyan
235
237
  end
236
238
 
237
239
  # wrapping methods for twitter state
238
- def status
239
- @json
240
+ %w(status event json).each do |name|
241
+ define_method name.to_sym do @json end
240
242
  end
241
243
 
242
244
  def update(msg)
243
- update_core :update, msg, @json
245
+ update_core ->(m){ @client.update m }, msg, @json
244
246
  end
245
247
 
246
248
  def reply(msg)
247
- update_core :reply, msg, @json
249
+ post_proc = ->(m){ @client.update m, :in_reply_to_status_id => event.id }
250
+ update_core post_proc, msg, @json
248
251
  end
249
252
 
250
- def update_core(mode, msg, json)
251
- i = 0
252
- if mode == :update
253
- post_text = lambda do |m|
254
- @access_token.post(
255
- '/statuses/update.json',
256
- 'status' => m,
257
- )
258
- end
259
- elsif mode == :reply
260
- post_text = lambda do |m|
261
- @access_token.post(
262
- '/statuses/update.json',
263
- 'status' => m,
264
- 'in_reply_to_status_id' => json['id']
265
- )
266
- end
267
- end
268
- while post_text.call(msg).code == '403' do
269
- sleep 0.3
270
- i += 1
271
- msg << " ."
272
- if i > 12
273
- puts "error to post reply to below"
274
- return false
253
+ def update_core(post_proc, msg, json)
254
+ 12.times do |n|
255
+ begin
256
+ break if post_proc.call msg
257
+ rescue Twitter::Error::Forbidden
258
+ sleep 0.5
259
+ msg << " ."
260
+ if n > 10
261
+ @logger.warn "error to post reply to below"
262
+ return false
263
+ end
275
264
  end
276
265
  end
277
- puts "replied to #{json['id']}"
266
+ @logger.info "replied to #{json.id}"
278
267
  true
279
268
  end
280
269
  end
@@ -1,3 +1,3 @@
1
1
  module BotNyan
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -0,0 +1 @@
1
+ {"delete":{"status":{"user_id_str":"76669699","id_str":"258956522690846720","id":258956522690846720,"user_id":76669699}}}
@@ -0,0 +1 @@
1
+ {"created_at":"Thu Oct 18 15:40:45 +0000 2012","event":"favorite","target":{"is_translator":false,"id":755838380,"created_at":"Mon Aug 13 21:09:44 +0000 2012","profile_background_color":"C0DEED","profile_image_url":"http:\/\/a0.twimg.com\/profile_images\/2636109325\/1ee9f773e6883cfc8b85a69a288fcae9_normal.png","default_profile":true,"follow_request_sent":false,"utc_offset":32400,"profile_background_image_url":"http:\/\/a0.twimg.com\/images\/themes\/theme1\/bg.png","id_str":"755838380","location":"\u30ab\u30b9\u30d4\u6d77","followers_count":3,"profile_link_color":"0084B4","name":"\u304a\u3055\u304b\u306a\u307c\u3063\u3068\u306b\u3083\u3093","lang":"en","listed_count":0,"protected":false,"statuses_count":61,"profile_use_background_image":true,"verified":false,"profile_text_color":"333333","description":"\u307c\u3063\u3068\u3061\u3083\u3093\u3067\u3059\u3045. \u0010\u30c7\u30e2\u7528\u3067\u3057\u2026\uff01","profile_sidebar_border_color":"C0DEED","default_profile_image":false,"following":true,"favourites_count":0,"friends_count":2,"contributors_enabled":false,"profile_background_tile":false,"time_zone":"Irkutsk","screen_name":"osakanabot","profile_sidebar_fill_color":"DDEEF6","profile_image_url_https":"https:\/\/si0.twimg.com\/profile_images\/2636109325\/1ee9f773e6883cfc8b85a69a288fcae9_normal.png","geo_enabled":false,"notifications":false,"url":"http:\/\/osakana.herokuapp.com\/","profile_background_image_url_https":"https:\/\/si0.twimg.com\/images\/themes\/theme1\/bg.png"},"source":{"is_translator":false,"id":76669699,"created_at":"Wed Sep 23 15:22:21 +0000 2009","profile_background_color":"EBEBEB","profile_image_url":"http:\/\/a0.twimg.com\/profile_images\/2637772890\/c672b4fc6815a145a753c63e3e742ef7_normal.png","default_profile":false,"follow_request_sent":false,"utc_offset":32400,"profile_background_image_url":"http:\/\/a0.twimg.com\/profile_background_images\/441842498\/noisy-sumi1.png","id_str":"76669699","location":"\u4eba\u9593\u754c(\uff84\uff73\uff77\uff6e\uff70)","followers_count":683,"profile_link_color":"D95971","name":"\u305f\u3044@\u9b5a\u985e\u306f\u8870\u9000\u3057\u307e\u3057\u305f","lang":"en","listed_count":50,"protected":false,"statuses_count":21664,"profile_use_background_image":true,"verified":false,"profile_text_color":"333333","description":"\u03b5( \u03b5^o^)\u044d\u3048\u3078\u3078. \uff86\uff9d\uff79\uff9e\uff9d\u754c\u306b\u7559\u5b66\u4e2d\u306e\u6d77\u6c34\u754c\u306e\u5e7c\u9b5a\u3067\u3057.\uff72\uff97\uff9d\u3068\u4e2d\u6771\u5730\u57df\u306b\u8208\u5473\u3042\u308a\u3067\u3057. \uff8c\uff9f\uff9b\uff78\uff9e\uff97\uff90\uff9d\uff78\uff9e\u3057\u3066\u307e\u3057. Ruby,Lisp\u3057\u304d. \uff8c\uff6b\uff9b\uff70\uff98\uff91\uff70\uff8c\uff9e\u81ea\u7531\u306b\u3067\u3057. \u591a\uff8e\uff9f\uff7d\uff84\u591a\uff8c\uff67\uff8e\uff9e @Taiki45tech @taiki45bot http:\/\/bit.ly\/oskana","profile_sidebar_border_color":"C0DEED","default_profile_image":false,"following":false,"favourites_count":62492,"friends_count":435,"contributors_enabled":false,"profile_background_tile":true,"time_zone":"Tokyo","screen_name":"taiki45","profile_sidebar_fill_color":"DDEEF6","profile_image_url_https":"https:\/\/si0.twimg.com\/profile_images\/2637772890\/c672b4fc6815a145a753c63e3e742ef7_normal.png","geo_enabled":false,"notifications":false,"url":"http:\/\/taiki45.github.com\/","profile_background_image_url_https":"https:\/\/si0.twimg.com\/profile_background_images\/441842498\/noisy-sumi1.png"},"target_object":{"in_reply_to_status_id":258935742812786688,"in_reply_to_status_id_str":"258935742812786688","in_reply_to_screen_name":"taiki45","in_reply_to_user_id":76669699,"in_reply_to_user_id_str":"76669699","id_str":"258935747300708352","favorited":true,"created_at":"Thu Oct 18 14:21:07 +0000 2012","contributors":null,"coordinates":null,"user":{"is_translator":false,"id":755838380,"created_at":"Mon Aug 13 21:09:44 +0000 2012","profile_background_color":"C0DEED","profile_image_url":"http:\/\/a0.twimg.com\/profile_images\/2636109325\/1ee9f773e6883cfc8b85a69a288fcae9_normal.png","default_profile":true,"follow_request_sent":false,"utc_offset":32400,"profile_background_image_url":"http:\/\/a0.twimg.com\/images\/themes\/theme1\/bg.png","id_str":"755838380","location":"\u30ab\u30b9\u30d4\u6d77","followers_count":3,"profile_link_color":"0084B4","name":"\u304a\u3055\u304b\u306a\u307c\u3063\u3068\u306b\u3083\u3093","lang":"en","listed_count":0,"protected":false,"statuses_count":61,"profile_use_background_image":true,"verified":false,"profile_text_color":"333333","description":"\u307c\u3063\u3068\u3061\u3083\u3093\u3067\u3059\u3045. \u0010\u30c7\u30e2\u7528\u3067\u3057\u2026\uff01","profile_sidebar_border_color":"C0DEED","default_profile_image":false,"following":true,"favourites_count":0,"friends_count":2,"contributors_enabled":false,"profile_background_tile":false,"time_zone":"Irkutsk","screen_name":"osakanabot","profile_sidebar_fill_color":"DDEEF6","profile_image_url_https":"https:\/\/si0.twimg.com\/profile_images\/2636109325\/1ee9f773e6883cfc8b85a69a288fcae9_normal.png","geo_enabled":false,"notifications":false,"url":"http:\/\/osakana.herokuapp.com\/","profile_background_image_url_https":"https:\/\/si0.twimg.com\/images\/themes\/theme1\/bg.png"},"place":null,"geo":null,"source":"\u003Ca href=\"http:\/\/osakana.herokuapp.com\" rel=\"nofollow\"\u003E\u307c\u3063\u3068\u306b\u3083\u3093\u003C\/a\u003E","retweeted":false,"retweet_count":0,"id":258935747300708352,"truncated":false,"text":"@taiki45 \u5929\u6c17\uff1f"}}
@@ -0,0 +1 @@
1
+ {"friends":[76669699,200750840]}
@@ -0,0 +1,3 @@
1
+ {"friends":[76669699,200750840]}
2
+
3
+
@@ -0,0 +1 @@
1
+ {"text":"@taiki45 Hello . .","retweeted":false,"contributors":null,"in_reply_to_status_id_str":"258955995236147200","in_reply_to_status_id":258955995236147200,"source":"\u003Ca href=\"http:\/\/osakana.herokuapp.com\" rel=\"nofollow\"\u003E\u307c\u3063\u3068\u306b\u3083\u3093\u003C\/a\u003E","entities":{"hashtags":[],"user_mentions":[{"indices":[0,8],"screen_name":"taiki45","name":"\u305f\u3044@\u9b5a\u985e\u306f\u8870\u9000\u3057\u307e\u3057\u305f","id":76669699,"id_str":"76669699"}],"urls":[]},"in_reply_to_user_id_str":"76669699","place":null,"in_reply_to_screen_name":"taiki45","in_reply_to_user_id":76669699,"favorited":false,"truncated":false,"coordinates":null,"retweet_count":0,"created_at":"Thu Oct 18 15:41:39 +0000 2012","user":{"profile_sidebar_border_color":"C0DEED","verified":false,"geo_enabled":false,"location":"\u30ab\u30b9\u30d4\u6d77","screen_name":"osakanabot","listed_count":0,"profile_use_background_image":true,"profile_image_url":"http:\/\/a0.twimg.com\/profile_images\/2636109325\/1ee9f773e6883cfc8b85a69a288fcae9_normal.png","friends_count":2,"profile_text_color":"333333","description":"\u307c\u3063\u3068\u3061\u3083\u3093\u3067\u3059\u3045. \u0010\u30c7\u30e2\u7528\u3067\u3057\u2026\uff01","is_translator":false,"default_profile":true,"profile_background_image_url_https":"https:\/\/si0.twimg.com\/images\/themes\/theme1\/bg.png","profile_background_image_url":"http:\/\/a0.twimg.com\/images\/themes\/theme1\/bg.png","contributors_enabled":false,"lang":"en","time_zone":"Irkutsk","profile_link_color":"0084B4","follow_request_sent":null,"profile_background_color":"C0DEED","protected":false,"profile_image_url_https":"https:\/\/si0.twimg.com\/profile_images\/2636109325\/1ee9f773e6883cfc8b85a69a288fcae9_normal.png","default_profile_image":false,"following":null,"notifications":null,"profile_background_tile":false,"created_at":"Mon Aug 13 21:09:44 +0000 2012","name":"\u304a\u3055\u304b\u306a\u307c\u3063\u3068\u306b\u3083\u3093","statuses_count":62,"favourites_count":0,"profile_sidebar_fill_color":"DDEEF6","followers_count":3,"url":"http:\/\/osakana.herokuapp.com\/","id":755838380,"id_str":"755838380","utc_offset":32400},"id":258956011921096704,"id_str":"258956011921096704","geo":null}
@@ -0,0 +1 @@
1
+ {"text":"@osakanabot \u03b5( \u03b5^o^)\u044d\u3078\u3044\u3078\u30fc\u3044","retweeted":false,"contributors":null,"in_reply_to_status_id_str":"258942827487170561","in_reply_to_status_id":258942827487170561,"source":"\u003Ca href=\"http:\/\/sites.google.com\/site\/yorufukurou\/\" rel=\"nofollow\"\u003EYoruFukurou\u003C\/a\u003E","entities":{"hashtags":[],"user_mentions":[{"indices":[0,11],"screen_name":"osakanabot","name":"\u304a\u3055\u304b\u306a\u307c\u3063\u3068\u306b\u3083\u3093","id":755838380,"id_str":"755838380"}],"urls":[]},"in_reply_to_user_id_str":"755838380","place":null,"in_reply_to_screen_name":"osakanabot","in_reply_to_user_id":755838380,"favorited":false,"truncated":false,"coordinates":null,"retweet_count":0,"created_at":"Thu Oct 18 15:41:35 +0000 2012","user":{"profile_sidebar_border_color":"C0DEED","verified":false,"geo_enabled":false,"location":"\u4eba\u9593\u754c(\uff84\uff73\uff77\uff6e\uff70)","screen_name":"taiki45","listed_count":50,"profile_use_background_image":true,"profile_image_url":"http:\/\/a0.twimg.com\/profile_images\/2637772890\/c672b4fc6815a145a753c63e3e742ef7_normal.png","friends_count":435,"profile_text_color":"333333","description":"\u03b5( \u03b5^o^)\u044d\u3048\u3078\u3078. \uff86\uff9d\uff79\uff9e\uff9d\u754c\u306b\u7559\u5b66\u4e2d\u306e\u6d77\u6c34\u754c\u306e\u5e7c\u9b5a\u3067\u3057.\uff72\uff97\uff9d\u3068\u4e2d\u6771\u5730\u57df\u306b\u8208\u5473\u3042\u308a\u3067\u3057. \uff8c\uff9f\uff9b\uff78\uff9e\uff97\uff90\uff9d\uff78\uff9e\u3057\u3066\u307e\u3057. Ruby,Lisp\u3057\u304d. \uff8c\uff6b\uff9b\uff70\uff98\uff91\uff70\uff8c\uff9e\u81ea\u7531\u306b\u3067\u3057. \u591a\uff8e\uff9f\uff7d\uff84\u591a\uff8c\uff67\uff8e\uff9e @Taiki45tech @taiki45bot http:\/\/bit.ly\/oskana","is_translator":false,"default_profile":false,"profile_background_image_url_https":"https:\/\/si0.twimg.com\/profile_background_images\/441842498\/noisy-sumi1.png","profile_background_image_url":"http:\/\/a0.twimg.com\/profile_background_images\/441842498\/noisy-sumi1.png","contributors_enabled":false,"lang":"en","time_zone":"Tokyo","profile_link_color":"D95971","follow_request_sent":null,"profile_background_color":"EBEBEB","protected":false,"profile_image_url_https":"https:\/\/si0.twimg.com\/profile_images\/2637772890\/c672b4fc6815a145a753c63e3e742ef7_normal.png","default_profile_image":false,"following":null,"notifications":null,"profile_background_tile":true,"created_at":"Wed Sep 23 15:22:21 +0000 2009","name":"\u305f\u3044@\u9b5a\u985e\u306f\u8870\u9000\u3057\u307e\u3057\u305f","statuses_count":21665,"favourites_count":62492,"profile_sidebar_fill_color":"DDEEF6","followers_count":683,"url":"http:\/\/taiki45.github.com\/","id":76669699,"id_str":"76669699","utc_offset":32400},"id":258955995236147200,"id_str":"258955995236147200","geo":null}
@@ -0,0 +1 @@
1
+ {"retweeted_status":{"text":"\u30bf\u30b3\uff01","retweeted":false,"contributors":null,"in_reply_to_status_id_str":null,"in_reply_to_status_id":null,"source":"\u003Ca href=\"http:\/\/sites.google.com\/site\/yorufukurou\/\" rel=\"nofollow\"\u003EYoruFukurou\u003C\/a\u003E","entities":{"hashtags":[],"user_mentions":[],"urls":[]},"in_reply_to_user_id_str":null,"place":null,"in_reply_to_screen_name":null,"in_reply_to_user_id":null,"favorited":false,"truncated":false,"coordinates":null,"retweet_count":1,"created_at":"Thu Oct 18 15:44:00 +0000 2012","user":{"profile_sidebar_border_color":"DBE9ED","verified":false,"geo_enabled":true,"location":"\u5de6\u8155","screen_name":"grapswiz","listed_count":220,"profile_use_background_image":true,"profile_image_url":"http:\/\/a0.twimg.com\/profile_images\/2637120733\/18d41255ae73c79ba465e654c28fe608_normal.jpeg","friends_count":1484,"profile_text_color":"333333","description":"\u3068\u3044\u3046\u5922\u3060\u3063\u305f\u306e\u3055\r\n\u30a2\u30a4\u30b3\u30f3: @catina013 \u6c0f","is_translator":false,"default_profile":false,"profile_background_image_url_https":"https:\/\/si0.twimg.com\/images\/themes\/theme17\/bg.gif","profile_background_image_url":"http:\/\/a0.twimg.com\/images\/themes\/theme17\/bg.gif","contributors_enabled":false,"lang":"ja","time_zone":"Tokyo","profile_link_color":"CC3366","follow_request_sent":null,"profile_background_color":"DBE9ED","protected":false,"profile_image_url_https":"https:\/\/si0.twimg.com\/profile_images\/2637120733\/18d41255ae73c79ba465e654c28fe608_normal.jpeg","default_profile_image":false,"following":null,"notifications":null,"profile_background_tile":false,"created_at":"Sun Jan 18 23:05:24 +0000 2009","name":"\u3050\u3089\u3077\u3059","statuses_count":186372,"favourites_count":53613,"profile_sidebar_fill_color":"E6F6F9","followers_count":1755,"url":"http:\/\/d.hatena.ne.jp\/grapswiz\/","id":19161647,"id_str":"19161647","utc_offset":32400},"id":258956606107176961,"id_str":"258956606107176961","geo":null},"text":"RT @grapswiz: \u30bf\u30b3\uff01","retweeted":false,"contributors":null,"in_reply_to_status_id_str":null,"in_reply_to_status_id":null,"source":"\u003Ca href=\"http:\/\/sites.google.com\/site\/yorufukurou\/\" rel=\"nofollow\"\u003EYoruFukurou\u003C\/a\u003E","entities":{"hashtags":[],"user_mentions":[{"indices":[3,12],"screen_name":"grapswiz","name":"\u3050\u3089\u3077\u3059","id":19161647,"id_str":"19161647"}],"urls":[]},"in_reply_to_user_id_str":null,"place":null,"in_reply_to_screen_name":null,"in_reply_to_user_id":null,"favorited":false,"truncated":false,"coordinates":null,"retweet_count":1,"created_at":"Thu Oct 18 15:44:48 +0000 2012","user":{"profile_sidebar_border_color":"C0DEED","verified":false,"geo_enabled":false,"location":"\u4eba\u9593\u754c(\uff84\uff73\uff77\uff6e\uff70)","screen_name":"taiki45","listed_count":50,"profile_use_background_image":true,"profile_image_url":"http:\/\/a0.twimg.com\/profile_images\/2637772890\/c672b4fc6815a145a753c63e3e742ef7_normal.png","friends_count":435,"profile_text_color":"333333","description":"\u03b5( \u03b5^o^)\u044d\u3048\u3078\u3078. \uff86\uff9d\uff79\uff9e\uff9d\u754c\u306b\u7559\u5b66\u4e2d\u306e\u6d77\u6c34\u754c\u306e\u5e7c\u9b5a\u3067\u3057.\uff72\uff97\uff9d\u3068\u4e2d\u6771\u5730\u57df\u306b\u8208\u5473\u3042\u308a\u3067\u3057. \uff8c\uff9f\uff9b\uff78\uff9e\uff97\uff90\uff9d\uff78\uff9e\u3057\u3066\u307e\u3057. Ruby,Lisp\u3057\u304d. \uff8c\uff6b\uff9b\uff70\uff98\uff91\uff70\uff8c\uff9e\u81ea\u7531\u306b\u3067\u3057. \u591a\uff8e\uff9f\uff7d\uff84\u591a\uff8c\uff67\uff8e\uff9e @Taiki45tech @taiki45bot http:\/\/bit.ly\/oskana","is_translator":false,"default_profile":false,"profile_background_image_url_https":"https:\/\/si0.twimg.com\/profile_background_images\/441842498\/noisy-sumi1.png","profile_background_image_url":"http:\/\/a0.twimg.com\/profile_background_images\/441842498\/noisy-sumi1.png","contributors_enabled":false,"lang":"en","time_zone":"Tokyo","profile_link_color":"D95971","follow_request_sent":null,"profile_background_color":"EBEBEB","protected":false,"profile_image_url_https":"https:\/\/si0.twimg.com\/profile_images\/2637772890\/c672b4fc6815a145a753c63e3e742ef7_normal.png","default_profile_image":false,"following":null,"notifications":null,"profile_background_tile":true,"created_at":"Wed Sep 23 15:22:21 +0000 2009","name":"\u305f\u3044@\u9b5a\u985e\u306f\u8870\u9000\u3057\u307e\u3057\u305f","statuses_count":21667,"favourites_count":62494,"profile_sidebar_fill_color":"DDEEF6","followers_count":683,"url":"http:\/\/taiki45.github.com\/","id":76669699,"id_str":"76669699","utc_offset":32400},"id":258956806154489856,"id_str":"258956806154489856","geo":null}
@@ -0,0 +1 @@
1
+ {"retweeted_status":{"text":"@taiki45 Hello . .","retweeted":false,"contributors":null,"in_reply_to_status_id_str":"258955995236147200","in_reply_to_status_id":258955995236147200,"source":"\u003Ca href=\"http:\/\/osakana.herokuapp.com\" rel=\"nofollow\"\u003E\u307c\u3063\u3068\u306b\u3083\u3093\u003C\/a\u003E","entities":{"hashtags":[],"user_mentions":[{"indices":[0,8],"screen_name":"taiki45","name":"\u305f\u3044@\u9b5a\u985e\u306f\u8870\u9000\u3057\u307e\u3057\u305f","id":76669699,"id_str":"76669699"}],"urls":[]},"in_reply_to_user_id_str":"76669699","place":null,"in_reply_to_screen_name":"taiki45","in_reply_to_user_id":76669699,"favorited":false,"truncated":false,"coordinates":null,"retweet_count":1,"created_at":"Thu Oct 18 15:41:39 +0000 2012","user":{"profile_sidebar_border_color":"C0DEED","verified":false,"geo_enabled":false,"location":"\u30ab\u30b9\u30d4\u6d77","screen_name":"osakanabot","listed_count":0,"profile_use_background_image":true,"profile_image_url":"http:\/\/a0.twimg.com\/profile_images\/2636109325\/1ee9f773e6883cfc8b85a69a288fcae9_normal.png","friends_count":2,"profile_text_color":"333333","description":"\u307c\u3063\u3068\u3061\u3083\u3093\u3067\u3059\u3045. \u0010\u30c7\u30e2\u7528\u3067\u3057\u2026\uff01","is_translator":false,"default_profile":true,"profile_background_image_url_https":"https:\/\/si0.twimg.com\/images\/themes\/theme1\/bg.png","profile_background_image_url":"http:\/\/a0.twimg.com\/images\/themes\/theme1\/bg.png","contributors_enabled":false,"lang":"en","time_zone":"Irkutsk","profile_link_color":"0084B4","follow_request_sent":null,"profile_background_color":"C0DEED","protected":false,"profile_image_url_https":"https:\/\/si0.twimg.com\/profile_images\/2636109325\/1ee9f773e6883cfc8b85a69a288fcae9_normal.png","default_profile_image":false,"following":null,"notifications":null,"profile_background_tile":false,"created_at":"Mon Aug 13 21:09:44 +0000 2012","name":"\u304a\u3055\u304b\u306a\u307c\u3063\u3068\u306b\u3083\u3093","statuses_count":62,"favourites_count":0,"profile_sidebar_fill_color":"DDEEF6","followers_count":3,"url":"http:\/\/osakana.herokuapp.com\/","id":755838380,"id_str":"755838380","utc_offset":32400},"id":258956011921096704,"id_str":"258956011921096704","geo":null},"text":"RT @osakanabot: @taiki45 Hello . .","retweeted":false,"contributors":null,"in_reply_to_status_id_str":null,"in_reply_to_status_id":null,"source":"\u003Ca href=\"http:\/\/sites.google.com\/site\/yorufukurou\/\" rel=\"nofollow\"\u003EYoruFukurou\u003C\/a\u003E","entities":{"hashtags":[],"user_mentions":[{"indices":[3,14],"screen_name":"osakanabot","name":"\u304a\u3055\u304b\u306a\u307c\u3063\u3068\u306b\u3083\u3093","id":755838380,"id_str":"755838380"},{"indices":[16,24],"screen_name":"taiki45","name":"\u305f\u3044@\u9b5a\u985e\u306f\u8870\u9000\u3057\u307e\u3057\u305f","id":76669699,"id_str":"76669699"}],"urls":[]},"in_reply_to_user_id_str":null,"place":null,"in_reply_to_screen_name":null,"in_reply_to_user_id":null,"favorited":false,"truncated":false,"coordinates":null,"retweet_count":1,"created_at":"Thu Oct 18 15:43:40 +0000 2012","user":{"profile_sidebar_border_color":"C0DEED","verified":false,"geo_enabled":false,"location":"\u4eba\u9593\u754c(\uff84\uff73\uff77\uff6e\uff70)","screen_name":"taiki45","listed_count":50,"profile_use_background_image":true,"profile_image_url":"http:\/\/a0.twimg.com\/profile_images\/2637772890\/c672b4fc6815a145a753c63e3e742ef7_normal.png","friends_count":435,"profile_text_color":"333333","description":"\u03b5( \u03b5^o^)\u044d\u3048\u3078\u3078. \uff86\uff9d\uff79\uff9e\uff9d\u754c\u306b\u7559\u5b66\u4e2d\u306e\u6d77\u6c34\u754c\u306e\u5e7c\u9b5a\u3067\u3057.\uff72\uff97\uff9d\u3068\u4e2d\u6771\u5730\u57df\u306b\u8208\u5473\u3042\u308a\u3067\u3057. \uff8c\uff9f\uff9b\uff78\uff9e\uff97\uff90\uff9d\uff78\uff9e\u3057\u3066\u307e\u3057. Ruby,Lisp\u3057\u304d. \uff8c\uff6b\uff9b\uff70\uff98\uff91\uff70\uff8c\uff9e\u81ea\u7531\u306b\u3067\u3057. \u591a\uff8e\uff9f\uff7d\uff84\u591a\uff8c\uff67\uff8e\uff9e @Taiki45tech @taiki45bot http:\/\/bit.ly\/oskana","is_translator":false,"default_profile":false,"profile_background_image_url_https":"https:\/\/si0.twimg.com\/profile_background_images\/441842498\/noisy-sumi1.png","profile_background_image_url":"http:\/\/a0.twimg.com\/profile_background_images\/441842498\/noisy-sumi1.png","contributors_enabled":false,"lang":"en","time_zone":"Tokyo","profile_link_color":"D95971","follow_request_sent":null,"profile_background_color":"EBEBEB","protected":false,"profile_image_url_https":"https:\/\/si0.twimg.com\/profile_images\/2637772890\/c672b4fc6815a145a753c63e3e742ef7_normal.png","default_profile_image":false,"following":null,"notifications":null,"profile_background_tile":true,"created_at":"Wed Sep 23 15:22:21 +0000 2009","name":"\u305f\u3044@\u9b5a\u985e\u306f\u8870\u9000\u3057\u307e\u3057\u305f","statuses_count":21667,"favourites_count":62492,"profile_sidebar_fill_color":"DDEEF6","followers_count":683,"url":"http:\/\/taiki45.github.com\/","id":76669699,"id_str":"76669699","utc_offset":32400},"id":258956522690846720,"id_str":"258956522690846720","geo":null}
@@ -0,0 +1 @@
1
+ {"text":"\u03b5( \u03b5^o^)\u044d\u306b\u3083","retweeted":false,"contributors":null,"in_reply_to_status_id_str":null,"in_reply_to_status_id":null,"source":"\u003Ca href=\"http:\/\/sites.google.com\/site\/yorufukurou\/\" rel=\"nofollow\"\u003EYoruFukurou\u003C\/a\u003E","entities":{"hashtags":[],"user_mentions":[],"urls":[]},"in_reply_to_user_id_str":null,"place":null,"in_reply_to_screen_name":null,"in_reply_to_user_id":null,"favorited":false,"truncated":false,"coordinates":null,"retweet_count":0,"created_at":"Thu Oct 18 15:40:14 +0000 2012","user":{"profile_sidebar_border_color":"C0DEED","verified":false,"geo_enabled":false,"location":"\u4eba\u9593\u754c(\uff84\uff73\uff77\uff6e\uff70)","screen_name":"taiki45","listed_count":50,"profile_use_background_image":true,"profile_image_url":"http:\/\/a0.twimg.com\/profile_images\/2637772890\/c672b4fc6815a145a753c63e3e742ef7_normal.png","friends_count":435,"profile_text_color":"333333","description":"\u03b5( \u03b5^o^)\u044d\u3048\u3078\u3078. \uff86\uff9d\uff79\uff9e\uff9d\u754c\u306b\u7559\u5b66\u4e2d\u306e\u6d77\u6c34\u754c\u306e\u5e7c\u9b5a\u3067\u3057.\uff72\uff97\uff9d\u3068\u4e2d\u6771\u5730\u57df\u306b\u8208\u5473\u3042\u308a\u3067\u3057. \uff8c\uff9f\uff9b\uff78\uff9e\uff97\uff90\uff9d\uff78\uff9e\u3057\u3066\u307e\u3057. Ruby,Lisp\u3057\u304d. \uff8c\uff6b\uff9b\uff70\uff98\uff91\uff70\uff8c\uff9e\u81ea\u7531\u306b\u3067\u3057. \u591a\uff8e\uff9f\uff7d\uff84\u591a\uff8c\uff67\uff8e\uff9e @Taiki45tech @taiki45bot http:\/\/bit.ly\/oskana","is_translator":false,"default_profile":false,"profile_background_image_url_https":"https:\/\/si0.twimg.com\/profile_background_images\/441842498\/noisy-sumi1.png","profile_background_image_url":"http:\/\/a0.twimg.com\/profile_background_images\/441842498\/noisy-sumi1.png","contributors_enabled":false,"lang":"en","time_zone":"Tokyo","profile_link_color":"D95971","follow_request_sent":null,"profile_background_color":"EBEBEB","protected":false,"profile_image_url_https":"https:\/\/si0.twimg.com\/profile_images\/2637772890\/c672b4fc6815a145a753c63e3e742ef7_normal.png","default_profile_image":false,"following":null,"notifications":null,"profile_background_tile":true,"created_at":"Wed Sep 23 15:22:21 +0000 2009","name":"\u305f\u3044@\u9b5a\u985e\u306f\u8870\u9000\u3057\u307e\u3057\u305f","statuses_count":21664,"favourites_count":62491,"profile_sidebar_fill_color":"DDEEF6","followers_count":683,"url":"http:\/\/taiki45.github.com\/","id":76669699,"id_str":"76669699","utc_offset":32400},"id":258955657036840961,"id_str":"258955657036840961","geo":null}
@@ -0,0 +1,3 @@
1
+ {"text":"test","retweeted":false,"contributors":null,"in_reply_to_status_id_str":null,"in_reply_to_status_id":null,"source":"\u003Ca href=\"http:\/\/sites.google.com\/site\/yorufukurou\/\" rel=\"nofollow\"\u003EYoruFukurou\u003C\/a\u003E","entities":{"hashtags":[],"user_mentions":[],"urls":[]},"in_reply_to_user_id_str":null,"place":null,"in_reply_to_screen_name":null,"in_reply_to_user_id":null,"favorited":false,"truncated":false,"coordinates":null,"retweet_count":0,"created_at":"Thu Oct 18 15:49:09 +0000 2012","user":{"profile_sidebar_border_color":"C0DEED","verified":false,"geo_enabled":false,"location":"\u4eba\u9593\u754c(\uff84\uff73\uff77\uff6e\uff70)","screen_name":"taiki45","listed_count":50,"profile_use_background_image":true,"profile_image_url":"http:\/\/a0.twimg.com\/profile_images\/2637772890\/c672b4fc6815a145a753c63e3e742ef7_normal.png","friends_count":435,"profile_text_color":"333333","description":"\u03b5( \u03b5^o^)\u044d\u3048\u3078\u3078. \uff86\uff9d\uff79\uff9e\uff9d\u754c\u306b\u7559\u5b66\u4e2d\u306e\u6d77\u6c34\u754c\u306e\u5e7c\u9b5a\u3067\u3057.\uff72\uff97\uff9d\u3068\u4e2d\u6771\u5730\u57df\u306b\u8208\u5473\u3042\u308a\u3067\u3057. \uff8c\uff9f\uff9b\uff78\uff9e\uff97\uff90\uff9d\uff78\uff9e\u3057\u3066\u307e\u3057. Ruby,Lisp\u3057\u304d. \uff8c\uff6b\uff9b\uff70\uff98\uff91\uff70\uff8c\uff9e\u81ea\u7531\u306b\u3067\u3057. \u591a\uff8e\uff9f\uff7d\uff84\u591a\uff8c\uff67\uff8e\uff9e @Taiki45tech @taiki45bot http:\/\/bit.ly\/oskana","is_translator":false,"default_profile":false,"profile_background_image_url_https":"https:\/\/si0.twimg.com\/profile_background_images\/441842498\/noisy-sumi1.png","profile_background_image_url":"http:\/\/a0.twimg.com\/profile_background_images\/441842498\/noisy-sumi1.png","contributors_enabled":false,"lang":"en","time_zone":"Tokyo","profile_link_color":"D95971","follow_request_sent":null,"profile_background_color":"EBEBEB","protected":false,"profile_image_url_https":"https:\/\/si0.twimg.com\/profile_images\/2637772890\/c672b4fc6815a145a753c63e3e742ef7_normal.png","default_profile_image":false,"following":null,"notifications":null,"profile_background_tile":true,"created_at":"Wed Sep 23 15:22:21 +0000 2009","name":"\u305f\u3044@\u9b5a\u985e\u306f\u8870\u9000\u3057\u307e\u3057\u305f","statuses_count":21668,"favourites_count":62495,"profile_sidebar_fill_color":"DDEEF6","followers_count":683,"url":"http:\/\/taiki45.github.com\/","id":76669699,"id_str":"76669699","utc_offset":32400},"id":258957899806670848,"id_str":"258957899806670848","geo":null}
2
+
3
+
@@ -0,0 +1,10 @@
1
+ # -*- coding: utf-8 -*-
2
+ $LOAD_PATH.unshift File.expand_path("../", __FILE__)
3
+ $LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
4
+
5
+ require 'bot_nyan'
6
+
7
+ def fixture_path
8
+ File.expand_path('../fixture/', __FILE__)
9
+ end
10
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bot_nyan
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-23 00:00:00.000000000 Z
12
+ date: 2012-10-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: oauth
@@ -61,6 +61,17 @@ files:
61
61
  - lib/bot_nyan/base.rb
62
62
  - lib/bot_nyan/main.rb
63
63
  - lib/bot_nyan/version.rb
64
+ - spec/fixtures/delete_tweet.json
65
+ - spec/fixtures/favorited.json
66
+ - spec/fixtures/init.json
67
+ - spec/fixtures/init.raw
68
+ - spec/fixtures/my_reply_tweet.json
69
+ - spec/fixtures/replyed_w_id.json
70
+ - spec/fixtures/retweet.json
71
+ - spec/fixtures/retweeted.json
72
+ - spec/fixtures/tweet.json
73
+ - spec/fixtures/tweet.raw
74
+ - spec/spec_helper.rb
64
75
  homepage: http://taiki45.github.com/bot_nyan
65
76
  licenses: []
66
77
  post_install_message:
@@ -85,4 +96,15 @@ rubygems_version: 1.8.23
85
96
  signing_key:
86
97
  specification_version: 3
87
98
  summary: Classy twitter-bot-framework in a DSL
88
- test_files: []
99
+ test_files:
100
+ - spec/fixtures/delete_tweet.json
101
+ - spec/fixtures/favorited.json
102
+ - spec/fixtures/init.json
103
+ - spec/fixtures/init.raw
104
+ - spec/fixtures/my_reply_tweet.json
105
+ - spec/fixtures/replyed_w_id.json
106
+ - spec/fixtures/retweet.json
107
+ - spec/fixtures/retweeted.json
108
+ - spec/fixtures/tweet.json
109
+ - spec/fixtures/tweet.raw
110
+ - spec/spec_helper.rb