lita-twitter 0.0.3 → 0.0.4

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: 11a676d53b6c458250f86a09a70e1ff21bcc80a9
4
- data.tar.gz: a5f56f766d22546c0104032f30bc93166b08ed2d
3
+ metadata.gz: ba7a06c938a206af9c3165e968b27032dc2d0b08
4
+ data.tar.gz: 6cc6a871ed9f2efd7216c36cc5efcaf550873cd2
5
5
  SHA512:
6
- metadata.gz: ecf2dfb294099214e83175bc48ca6ae0356457edbfb1b21859e6dc4259acf2adc4aec48c3e16b413f905f5f7da0ce7677bbc10ab9213efbe7ff8e3603a8ad003
7
- data.tar.gz: 9d7cfb382b0a7a6362fbb0c83fa7adb204133c7e8760c5ab82bd8344a87f3014e44e7c0db6030c7bb2feeff95a23056fba5d19d96d9119d55f44ebdd169ad34d
6
+ metadata.gz: 9828db77c6044ab250cffabab36d734b5f587b505a6e428a50a923a85a80acc438a903b13924117b4a8c3bd16c005bd65241d179b8da32171a9c82317e1f1e3f
7
+ data.tar.gz: dec70642141617ddc90e1d612568a2dcc3e218d5067d014b4dcfb3c22620415e10253a89b72754427964fae443ebad02083a253d44e8c0ada57aa90505724bf6
@@ -55,13 +55,20 @@ module Lita
55
55
  end
56
56
 
57
57
  def message(target, strings)
58
- text = strings.join("\n")[0...140]
59
- if target.private_message
60
- rest_client.create_direct_message(target.user.name, text)
61
- elsif target.user
62
- rest_client.update(text, in_reply_to_status_id: target.room)
63
- else
64
- rest_client.update(text)
58
+ tries = 0
59
+ text = strings.join("\n")[0...137]
60
+ begin
61
+ if target.private_message
62
+ rest_client.create_direct_message(target.user.name, text)
63
+ elsif target.user
64
+ rest_client.update(text, in_reply_to_status_id: target.room)
65
+ else
66
+ rest_client.update(text)
67
+ end
68
+ rescue Twitter::Error::DuplicateStatus => e
69
+ tries += 1
70
+ text += "⠀" #U+2800
71
+ retry if tries <= 3
65
72
  end
66
73
  end
67
74
 
@@ -1,5 +1,5 @@
1
1
  module Lita
2
2
  module Twitter
3
- VERSION = "0.0.3"
3
+ VERSION = "0.0.4"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lita-twitter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - fukayatsu