lita-tipbot 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 859a431c9a77933c570e155163949d68dc414008
4
- data.tar.gz: e1809b39eb9360a88515c3efab0e84f511bda247
3
+ metadata.gz: 36cd785e3457f80c5ebbf7b54a9f663f65f57f87
4
+ data.tar.gz: 0c995a0e726262b623deb9769e65ed392ed7188f
5
5
  SHA512:
6
- metadata.gz: 9617ea735081584d93662a9242e10befd1d8d44a37019aefbbe976b25647088ce9c927edb75084ff00e179c20cf5c84bffd3566802ceff522ddfced509358e03
7
- data.tar.gz: be2237048c0ded054733f7cd0644fde59cd40fb033cf84892d85f8f19d2b753201e7f9b310c57d15a246985723d73f58db16d927c04fbbfce1e3cfe8c2c6a8f0
6
+ metadata.gz: 383b2a1ec95d4b68d2828890b9ea585a9e7457f787b69ff8f789e8b90231fdbc19398fba634147e55fddf6379d42ed315d3e54ab0d06c5cdf818080efd93aea7
7
+ data.tar.gz: b4d56a381e2a3c368cf4fe674197b3535c1243ff93d56c529e0cfef926030bc4e0c4aa646556da2042d6dc2f41ace58a70ddb39f27670d88cd6cd5565bb3ed75
@@ -195,6 +195,144 @@ module Lita
195
195
  end
196
196
  end
197
197
 
198
+ # haphazardly give some percentage of people in the room 1-50 doge
199
+ def make_it_wayne(response)
200
+ images = [
201
+ "http://a4.files.saymedia-content.com/image/upload/c_fill,g_face,h_300,q_80,w_300/MTE5NTU2MzE2NDIxMTk1Mjc1.jpg",
202
+ "http://www.whale.to/c/9_23_09_wayne_newton_kabik-14-570.jpg",
203
+ "http://www.aceshowbiz.com/images/wennpic/wayne-newton-2013-american-music-awards-01.jpg",
204
+ "http://thestarsurgery.com/wp-content/uploads/2013/06/Wayne-Newton.jpg",
205
+ "http://www.mtv.com/crop-images/2013/08/27/WayneNewton_cr_EthanMiller_2009.jpg"
206
+ ]
207
+
208
+ response.reply([
209
+ "Watch out! #{response.user.name} is makin' it Wayne!",
210
+ images.sample
211
+ ])
212
+
213
+ src_hash = user_hash(response.user.mention_name)
214
+ room_jid = response.message.source.room
215
+ users = active_room_members room_jid
216
+
217
+ # wayne's generosity typically runs out before everyone gets a tip
218
+ max_recipients = Random.rand(1..users.size)
219
+
220
+ max_recipients.times do
221
+
222
+ # wayne has had a few too many and forgets who he has already tipped
223
+ user = users.sample
224
+
225
+ log.info "tipping #{user['email']}"
226
+
227
+ dest_hash = hash_email user['email']
228
+ log.debug "SRC HASH: #{src_hash}"
229
+ log.debug "DEST HASH: #{dest_hash}"
230
+ log.debug "NAME: #{user['name']}"
231
+
232
+ amount = Random.rand(1..50)
233
+ response.reply "#{amount} for #{user['name']}!"
234
+
235
+ tipbot_api.tip src_hash, dest_hash, amount
236
+ end
237
+ end
238
+
239
+ # give a random person a random amount of 1-200 doge
240
+ def make_it_blaine(response)
241
+ images = [
242
+ "http://cdn.images.express.co.uk/img/dynamic/79/590x/444280_1.jpg",
243
+ "http://currentbuzz.my/Documents/Article/508176/TV%20street%20magician%20David%20Blaine_i2_cdnds_net.jpg",
244
+ "http://i.dailymail.co.uk/i/pix/2012/10/08/article-2214386-15633B31000005DC-349_306x423.jpg",
245
+ "http://i.telegraph.co.uk/multimedia/archive/01394/blaine_1394717c.jpg",
246
+ "http://i.ytimg.com/vi/fqJ0GaVU344/hqdefault.jpg"
247
+ ]
248
+
249
+ response.reply([
250
+ "What's that behind your ear? #{response.user.name} is makin' it Blaine!",
251
+ images.sample
252
+ ])
253
+
254
+ src_hash = user_hash(response.user.mention_name)
255
+ room_jid = response.message.source.room
256
+ users = active_room_members room_jid
257
+
258
+ user = users.sample
259
+ amount = Random.rand(1..200)
260
+
261
+ log.info "tipping #{user['email']}"
262
+
263
+ dest_hash = hash_email user['email']
264
+ log.debug "SRC HASH: #{src_hash}"
265
+ log.debug "DEST HASH: #{dest_hash}"
266
+ log.debug "NAME: #{user['name']}"
267
+
268
+ response.reply "Someone just received #{amount}!"
269
+ tipbot_api.tip src_hash, dest_hash, amount
270
+ end
271
+
272
+ # give a random person a random amount of 1-32 doge
273
+ def make_it_crane(response)
274
+ images = [
275
+ "http://upload.wikimedia.org/wikipedia/en/6/68/Frasier_Crane_Shrink_Wrap_radio_station_KACL.jpg",
276
+ "http://0.media.dorkly.cvcdn.com/47/63/8525949c344ca18f060a73d22e4cafde-dr-frasier-crane.jpg",
277
+ "http://rushthefence.com/content/images/2014/Mar/Morgan_Bateson.jpg",
278
+ "https://38.media.tumblr.com/97d26f1f5c3979b5d0ca26a49490c946/tumblr_mk8hl1u5va1s2n8qho1_500.png",
279
+ "http://snakkle.wpengine.netdna-cdn.com/wp-content/uploads/2012/09/kelsey-grammer-cheers-tv-1985-photo-GC.jpg"
280
+ ]
281
+
282
+ response.reply([
283
+ "#{response.user.name} is makin' it Frasier Crane!",
284
+ images.sample
285
+ ])
286
+
287
+ src_hash = user_hash(response.user.mention_name)
288
+ room_jid = response.message.source.room
289
+ users = active_room_members room_jid
290
+
291
+ user = users.sample
292
+ amount = Random.rand(1..32)
293
+
294
+ log.info "tipping #{user['email']}"
295
+
296
+ dest_hash = hash_email user['email']
297
+ log.debug "SRC HASH: #{src_hash}"
298
+ log.debug "DEST HASH: #{dest_hash}"
299
+ log.debug "NAME: #{user['name']}"
300
+
301
+ response.reply "#{user['name']} just received #{amount}!"
302
+ tipbot_api.tip src_hash, dest_hash, amount
303
+ end
304
+
305
+ # give a random person a random amount of 1-32 doge
306
+ def make_it_reign(response)
307
+ images = [
308
+ "http://i.imgur.com/WOzIWAs.gif",
309
+ "http://i.imgur.com/QlhuS09.gif",
310
+ "http://i.imgur.com/8RC90ul.gif"
311
+ ]
312
+
313
+ response.reply([
314
+ "#{response.user.name} is makin' it Reign!",
315
+ images.sample
316
+ ])
317
+
318
+ src_hash = user_hash(response.user.mention_name)
319
+ room_jid = response.message.source.room
320
+ users = active_room_members room_jid
321
+
322
+ user = users.sample
323
+ amount = Random.rand(1..32)
324
+
325
+ log.info "tipping #{user['email']}"
326
+
327
+ dest_hash = hash_email user['email']
328
+ log.debug "SRC HASH: #{src_hash}"
329
+ log.debug "DEST HASH: #{dest_hash}"
330
+ log.debug "NAME: #{user['name']}"
331
+
332
+ response.reply "#{user['name']} just received #{amount}!"
333
+ tipbot_api.tip src_hash, dest_hash, amount
334
+ end
335
+
198
336
  attr_writer :hipchat_api, :tipbot_api
199
337
 
200
338
  def hipchat_api
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "lita-tipbot"
3
- spec.version = "0.1.2"
3
+ spec.version = "0.2.0"
4
4
  spec.authors = ["Chris Chalfant"]
5
5
  spec.email = ["chalfants@gmail.com"]
6
6
  spec.description = "Tip people with dogecoins!"
@@ -93,6 +93,114 @@ describe Lita::Handlers::Tipbot, lita_handler: true do
93
93
  end
94
94
  end
95
95
 
96
+ describe '#make_it_wayne' do
97
+ let(:active_users) {
98
+ [
99
+ {
100
+ 'name' => user.name,
101
+ 'mention_name' => user.mention_name,
102
+ 'email' => 'test@foo.com'
103
+ },
104
+ {
105
+ 'name' => 'someguy',
106
+ 'mention_name' => '@someguy',
107
+ 'email' => 'someguy@foo.com'
108
+ }
109
+ ]
110
+ }
111
+
112
+ before(:each) do
113
+ allow(subject).to receive(:active_room_members).and_return(active_users)
114
+ subject.tipbot_api = spy('tip')
115
+ end
116
+
117
+ it 'tips a user' do
118
+ send_message("tipbot make it wayne")
119
+ expect(subject.tipbot_api).to have_received(:tip).at_least(:once)
120
+ end
121
+ end
122
+
123
+ describe '#make_it_blaine' do
124
+ let(:active_users) {
125
+ [
126
+ {
127
+ 'name' => user.name,
128
+ 'mention_name' => user.mention_name,
129
+ 'email' => 'test@foo.com'
130
+ },
131
+ {
132
+ 'name' => 'someguy',
133
+ 'mention_name' => '@someguy',
134
+ 'email' => 'someguy@foo.com'
135
+ }
136
+ ]
137
+ }
138
+
139
+ before(:each) do
140
+ allow(subject).to receive(:active_room_members).and_return(active_users)
141
+ end
142
+
143
+ it 'tips one and only one user' do
144
+ subject.tipbot_api = spy('tip')
145
+ send_message("tipbot make it blaine")
146
+ expect(subject.tipbot_api).to have_received(:tip).once
147
+ end
148
+ end
149
+
150
+ describe '#make_it_crane' do
151
+ let(:active_users) {
152
+ [
153
+ {
154
+ 'name' => user.name,
155
+ 'mention_name' => user.mention_name,
156
+ 'email' => 'test@foo.com'
157
+ },
158
+ {
159
+ 'name' => 'someguy',
160
+ 'mention_name' => '@someguy',
161
+ 'email' => 'someguy@foo.com'
162
+ }
163
+ ]
164
+ }
165
+
166
+ before(:each) do
167
+ allow(subject).to receive(:active_room_members).and_return(active_users)
168
+ end
169
+
170
+ it 'tips one and only one user' do
171
+ subject.tipbot_api = spy('tip')
172
+ send_message("tipbot make it crane")
173
+ expect(subject.tipbot_api).to have_received(:tip).once
174
+ end
175
+ end
176
+
177
+ describe '#make_it_reign' do
178
+ let(:active_users) {
179
+ [
180
+ {
181
+ 'name' => user.name,
182
+ 'mention_name' => user.mention_name,
183
+ 'email' => 'test@foo.com'
184
+ },
185
+ {
186
+ 'name' => 'someguy',
187
+ 'mention_name' => '@someguy',
188
+ 'email' => 'someguy@foo.com'
189
+ }
190
+ ]
191
+ }
192
+
193
+ before(:each) do
194
+ allow(subject).to receive(:active_room_members).and_return(active_users)
195
+ end
196
+
197
+ it 'tips one and only one user' do
198
+ subject.tipbot_api = spy('tip')
199
+ send_message("tipbot make it reign")
200
+ expect(subject.tipbot_api).to have_received(:tip).once
201
+ end
202
+ end
203
+
96
204
  describe '#hash_email' do
97
205
  it 'hashes properly' do
98
206
  email = 'cchalfant@leafsoftwaresolutions.com'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lita-tipbot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Chalfant
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-09 00:00:00.000000000 Z
11
+ date: 2015-04-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lita