telegram-bot-ruby 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +15 -3
- data/lib/telegram/bot.rb +1 -1
- data/lib/telegram/bot/{runner.rb → client.rb} +1 -1
- data/lib/telegram/bot/version.rb +1 -1
- data/{telegram-bot.gemspec → telegram-bot-ruby.gemspec} +0 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 42f3aaa643f89d7ac2534a93a9867567706c3412
|
4
|
+
data.tar.gz: c1e130a68c7e98375a0c536ebe8a62f16bdc5990
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6a030e8417d75db739206e74cafae2502d0cfe97b5dd584ec9880d391fea050a0dd4e9102374fdba347d8a1c6ac88772bbf517857740132562f620e8cfa4cce2
|
7
|
+
data.tar.gz: 5a226a421b69610e6d691ea0aeeb91a7c455ddf0ff82f70d518625b18c12ff4f7730953bc6bfd448bd40ca740ddd85183af67e7699de8a4d3abcead5d800bf87
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# telegram-bot
|
1
|
+
# telegram-bot-ruby
|
2
2
|
|
3
3
|
Ruby wrapper for [Telegram's Bot API](https://core.telegram.org/bots/api).
|
4
4
|
|
@@ -7,7 +7,7 @@ Ruby wrapper for [Telegram's Bot API](https://core.telegram.org/bots/api).
|
|
7
7
|
Add following line to your Gemfile:
|
8
8
|
|
9
9
|
```ruby
|
10
|
-
gem 'telegram-bot
|
10
|
+
gem 'telegram-bot-ruby'
|
11
11
|
```
|
12
12
|
|
13
13
|
And then execute:
|
@@ -16,14 +16,22 @@ And then execute:
|
|
16
16
|
$ bundle
|
17
17
|
```
|
18
18
|
|
19
|
+
Or install it system-wide:
|
20
|
+
|
21
|
+
```shell
|
22
|
+
$ gem install telegram-bot-ruby
|
23
|
+
```
|
24
|
+
|
19
25
|
## Usage
|
20
26
|
|
21
27
|
First things first, you need to [obtain a token](https://core.telegram.org/bots#botfather) for your bot. Then create your Telegram bot like this:
|
22
28
|
|
23
29
|
```ruby
|
30
|
+
require 'telegram/bot'
|
31
|
+
|
24
32
|
token = 'YOUR_TELEGRAM_BOT_API_TOKEN'
|
25
33
|
|
26
|
-
Telegram::Bot::
|
34
|
+
Telegram::Bot::Client.run(token) do |bot|
|
27
35
|
bot.listen do |message|
|
28
36
|
case message.text
|
29
37
|
when /^hello/
|
@@ -33,6 +41,10 @@ Telegram::Bot::Runner.run(token) do |bot|
|
|
33
41
|
end
|
34
42
|
```
|
35
43
|
|
44
|
+
Note that `bot.api` object implements [Telegram Bot API methods](https://core.telegram.org/bots/api#available-methods) as is. So you can invoke any method inside the block without any problems.
|
45
|
+
|
46
|
+
Same thing about `message` object - it implements [Message](https://core.telegram.org/bots/api#message) spec, so you always know what to expect from it.
|
47
|
+
|
36
48
|
## Contributing
|
37
49
|
|
38
50
|
1. Fork it
|
data/lib/telegram/bot.rb
CHANGED
data/lib/telegram/bot/version.rb
CHANGED
File without changes
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: telegram-bot-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Tipugin
|
@@ -125,7 +125,7 @@ files:
|
|
125
125
|
- bin/setup
|
126
126
|
- lib/telegram/bot.rb
|
127
127
|
- lib/telegram/bot/api.rb
|
128
|
-
- lib/telegram/bot/
|
128
|
+
- lib/telegram/bot/client.rb
|
129
129
|
- lib/telegram/bot/types.rb
|
130
130
|
- lib/telegram/bot/types/audio.rb
|
131
131
|
- lib/telegram/bot/types/base.rb
|
@@ -140,7 +140,7 @@ files:
|
|
140
140
|
- lib/telegram/bot/types/user.rb
|
141
141
|
- lib/telegram/bot/types/video.rb
|
142
142
|
- lib/telegram/bot/version.rb
|
143
|
-
- telegram-bot.gemspec
|
143
|
+
- telegram-bot-ruby.gemspec
|
144
144
|
homepage: https://github.com/atipugin/telegram-bot
|
145
145
|
licenses: []
|
146
146
|
metadata: {}
|