telegram-bot-ruby 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/telegram/bot/client.rb +13 -11
- data/lib/telegram/bot/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0736511a6c4fa9c27902fe5b18330aee0a90c733
|
4
|
+
data.tar.gz: af1edd744e538db9638c1a35904e4e12cf475e8e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 829e4c7f85a03cb3e929dd3b930fdba8f2401160f1ebc8f6f6ac4fa40966106b7b557285338f375345c7f1ba49bedc630f65a271d674a5aa5e6de8419c64bf30
|
7
|
+
data.tar.gz: 592a7fa7785301d046c699111d785ba100a359327ca3cb10733770c77e7c893eb3e2cfead22526d9f2f2572f7a58c51bc0ea3a99314be69e6286a6bb642c80a9
|
data/lib/telegram/bot/client.rb
CHANGED
@@ -22,17 +22,19 @@ module Telegram
|
|
22
22
|
yield self
|
23
23
|
end
|
24
24
|
|
25
|
-
def listen
|
26
|
-
loop
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
25
|
+
def listen(&block)
|
26
|
+
loop { fetch_updates(&block) }
|
27
|
+
end
|
28
|
+
|
29
|
+
def fetch_updates
|
30
|
+
response = api.getUpdates(offset: offset, timeout: timeout)
|
31
|
+
return unless response['ok']
|
32
|
+
|
33
|
+
response['result'].each do |data|
|
34
|
+
update = Types::Update.new(data)
|
35
|
+
@offset = update.update_id.next
|
36
|
+
log_incoming_message(update.message)
|
37
|
+
yield update.message
|
36
38
|
end
|
37
39
|
rescue *TIMEOUT_EXCEPTIONS
|
38
40
|
retry
|
data/lib/telegram/bot/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: telegram-bot-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Tipugin
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httmultiparty
|