bender-bot 0.5.3 → 0.5.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/lib/bender/bot.rb +23 -5
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d2171e9575b5e902190f80671fc54d50d3a29807
4
- data.tar.gz: fe7a496b89279728545e4fe032f2c964c9e5b45c
3
+ metadata.gz: 0c6ccf91cc16760e71a6db34d3477f511c014d6b
4
+ data.tar.gz: 63313c668f314ebae70d5b1ad7ac3b3cb8b2fe9e
5
5
  SHA512:
6
- metadata.gz: 601fed44461ff0050a959c50d246a8acbcde081d3b2d0d8040df01d8a359785f13e5d15a337288280aa40614d87bcfd5a70d026575469aa8d988565e0e8957ea
7
- data.tar.gz: 41985123cd22f41401a556c3ce56bcaabc21b6252c22ff9f624c1699668ef2499b7c0930d2860834f0066b6866da9eb7c382f65f7ee90072ebdb3e6b02be882e
6
+ metadata.gz: 7feddba434c6bcf352be75172ec648cfb473ff51ca17d2cab5b00aef8d45e80db5a2219ac75b11f986014efefe225c08f6175d80f2d58ecaaa78e9d593c68146
7
+ data.tar.gz: 2477050045190842fe7dcca51c42ec658dc3798f8efcf8b446325e8513a45618e03b04766d93a38952a870c17f8d6cf5d91b03e2abb9eb4236ca2171eb0b6caa
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.3
1
+ 0.5.4
data/lib/bender/bot.rb CHANGED
@@ -70,10 +70,22 @@ class BenderBot
70
70
  }
71
71
  }
72
72
 
73
+
74
+
73
75
  def reply_html message, color=:yellow
74
- @@hipchat[@room_name].send(nick, message, color: color)
76
+ tries ||= 3
77
+ @@hipchat[@this_room.name].send(nick, message, color: color)
78
+ rescue
79
+ tries -= 1
80
+ if tries > 0
81
+ refresh_room @this_room.xmpp_jid
82
+ log.warn reason: 'could not reply_html', remediation: 'retrying'
83
+ retry
84
+ end
85
+ log.error reason: 'could not reply_html'
75
86
  end
76
87
 
88
+
77
89
  def reply_with_help
78
90
  help = COMMANDS.each.map do |cmd, opts|
79
91
  opts[:cmd] ||= cmd
@@ -87,15 +99,21 @@ class BenderBot
87
99
  end
88
100
 
89
101
 
90
- def handle room, sender, message
102
+ def refresh_room jid
91
103
  begin
92
- @room_name = @@rooms.select { |r| r.xmpp_jid == room }.first.name
93
- @@hipchat[@room_name].get_room # test
104
+ @this_room = @@rooms.select { |r| r.xmpp_jid == jid }.first
105
+ @@hipchat[@this_room.name].get_room # test
94
106
  rescue
95
107
  @@hipchat = HipChat::Client.new(@@options.hipchat_token)
96
108
  @@rooms = @@hipchat.rooms
97
- @room_name = @@rooms.select { |r| r.xmpp_jid == room }.first.name
109
+ @this_room = @@rooms.select { |r| r.xmpp_jid == jid }.first
98
110
  end
111
+ end
112
+
113
+
114
+ def handle room, sender, message
115
+ refresh_room room
116
+
99
117
  @room = room
100
118
  @sender = sender
101
119
  @message = message
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bender-bot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 0.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Clemmer