telegram-bot-ruby 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/telegram/bot/client.rb +4 -3
- data/lib/telegram/bot/version.rb +1 -1
- 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: b9f0ea70d6518a6c8151a83e6ab922c3b4724b49
|
4
|
+
data.tar.gz: 2397c4d6744e443e3f9aae921566c130547ae870
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac7225aaedd1f4261b6967b9788cf8e4836303434691ef771fe9eb97d32de77855d17220fe263d6dc25b8e504e5f056869bef85416b69cd245adf28eee3457ee
|
7
|
+
data.tar.gz: 89ed4164c4173139cdaaa98865d731b0442af459d605289f632bfb67a606f267b6e8d3391347914d73b31b2af8b32ddbf5b8012325eb09f47256dfa7a194e590
|
data/README.md
CHANGED
@@ -74,7 +74,7 @@ end
|
|
74
74
|
|
75
75
|
## File upload
|
76
76
|
|
77
|
-
Your bot can even upload files
|
77
|
+
Your bot can even upload files ([photos](https://core.telegram.org/bots/api#sendphoto), [audio](https://core.telegram.org/bots/api#sendaudio), [documents](https://core.telegram.org/bots/api#senddocument), [stickers](https://core.telegram.org/bots/api#sendsticker), [video](https://core.telegram.org/bots/api#sendvideo)) to Telegram servers. Just like this:
|
78
78
|
|
79
79
|
```ruby
|
80
80
|
bot.listen do |message|
|
data/lib/telegram/bot/client.rb
CHANGED
@@ -1,15 +1,16 @@
|
|
1
1
|
module Telegram
|
2
2
|
module Bot
|
3
3
|
class Client
|
4
|
-
attr_reader :api, :offset
|
4
|
+
attr_reader :api, :offset, :timeout
|
5
5
|
|
6
6
|
def self.run(*args, &block)
|
7
7
|
new(*args).run(&block)
|
8
8
|
end
|
9
9
|
|
10
|
-
def initialize(token)
|
10
|
+
def initialize(token, timeout = 20)
|
11
11
|
@api = Api.new(token)
|
12
12
|
@offset = 0
|
13
|
+
@timeout = timeout
|
13
14
|
end
|
14
15
|
|
15
16
|
def run
|
@@ -18,7 +19,7 @@ module Telegram
|
|
18
19
|
|
19
20
|
def listen
|
20
21
|
loop do
|
21
|
-
response = api.getUpdates(offset: offset)
|
22
|
+
response = api.getUpdates(offset: offset, timeout: timeout)
|
22
23
|
next unless response['ok']
|
23
24
|
|
24
25
|
response['result'].each do |data|
|
data/lib/telegram/bot/version.rb
CHANGED