bender-bot 0.5.3 → 0.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/bender/bot.rb +23 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c6ccf91cc16760e71a6db34d3477f511c014d6b
|
4
|
+
data.tar.gz: 63313c668f314ebae70d5b1ad7ac3b3cb8b2fe9e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7feddba434c6bcf352be75172ec648cfb473ff51ca17d2cab5b00aef8d45e80db5a2219ac75b11f986014efefe225c08f6175d80f2d58ecaaa78e9d593c68146
|
7
|
+
data.tar.gz: 2477050045190842fe7dcca51c42ec658dc3798f8efcf8b446325e8513a45618e03b04766d93a38952a870c17f8d6cf5d91b03e2abb9eb4236ca2171eb0b6caa
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
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
|
-
|
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
|
102
|
+
def refresh_room jid
|
91
103
|
begin
|
92
|
-
@
|
93
|
-
@@hipchat[@
|
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
|
-
@
|
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
|