telegram-bot 0.15.3 → 0.15.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile +1 -1
- data/README.md +51 -19
- data/lib/telegram/bot/client/api_methods.txt +7 -3
- data/lib/telegram/bot/updates_controller.rb +2 -0
- data/lib/telegram/bot/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ce64ac3361d5b02948e28ddef05bdc084ea6f6681889bda5ccd2d77e544f3a91
|
4
|
+
data.tar.gz: 02f9adbc5cb3fc0af167c7f55c7bf716a9fef3f88706339be9948e50c410d11a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9b85de3de3da3f5adea3412a1642f6dbe831ed3b79d6a228eddf210c3ba6228396b9e9c69513848331d0a04261a6623487e7b1db8b5268aced95f18624225e49
|
7
|
+
data.tar.gz: 396074577bc0bbe7f7bb189408ec5134d66a44629928a95bd0fa60ec43474be60bb110f778d4de65d3d96ce4ffedd50436c88219df1198928bc4655a4c014143
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/telegram-bot.svg)](http://badge.fury.io/rb/telegram-bot)
|
4
4
|
[![Code Climate](https://codeclimate.com/github/telegram-bot-rb/telegram-bot/badges/gpa.svg)](https://codeclimate.com/github/telegram-bot-rb/telegram-bot)
|
5
|
-
[![Build Status](https://travis-ci.
|
5
|
+
[![Build Status](https://travis-ci.com/telegram-bot-rb/telegram-bot.svg)](https://travis-ci.com/telegram-bot-rb/telegram-bot)
|
6
6
|
|
7
7
|
Tools for developing Telegram bots. Best used with Rails, but can be used in
|
8
8
|
[standalone app](https://github.com/telegram-bot-rb/telegram-bot/wiki/Not-rails-application).
|
@@ -25,9 +25,33 @@ with session, keyboards and inline queries.
|
|
25
25
|
Run it on your local machine in 1 minute!
|
26
26
|
|
27
27
|
And here is [app template](https://github.com/telegram-bot-rb/rails_template)
|
28
|
-
to generate
|
29
|
-
|
30
|
-
|
28
|
+
to generate new rails app in seconds.
|
29
|
+
|
30
|
+
See examples and cookbook in [the wiki](https://github.com/telegram-bot-rb/telegram-bot/wiki).
|
31
|
+
|
32
|
+
## Table of Contents
|
33
|
+
|
34
|
+
* [Installation](#installation)
|
35
|
+
* [Usage](#usage)
|
36
|
+
* [Configuration](#configuration)
|
37
|
+
* [Configuration in Rails app](#configuration-in-rails-app)
|
38
|
+
* [Client](#client)
|
39
|
+
* [Typed responses](#typed-responses)
|
40
|
+
* [Controller](#controller)
|
41
|
+
* [Reply helpers](#reply-helpers)
|
42
|
+
* [Optional typecasting](#optional-typecasting)
|
43
|
+
* [Session](#session)
|
44
|
+
* [Message context](#message-context)
|
45
|
+
* [Callback queries](#callback-queries)
|
46
|
+
* [Routes in Rails app](#routes-in-rails-app)
|
47
|
+
* [Processing updates](#processing-updates)
|
48
|
+
* [Development & Debugging](#development--debugging)
|
49
|
+
* [Testing](#testing)
|
50
|
+
* [Deployment](#deployment)
|
51
|
+
* [Async mode](#async-mode)
|
52
|
+
* [Limitations](#limitations)
|
53
|
+
* [Development](#development)
|
54
|
+
* [Contributing](#contributing)
|
31
55
|
|
32
56
|
## Installation
|
33
57
|
|
@@ -39,11 +63,15 @@ gem 'telegram-bot'
|
|
39
63
|
|
40
64
|
And then execute:
|
41
65
|
|
42
|
-
|
66
|
+
```
|
67
|
+
bundle
|
68
|
+
```
|
43
69
|
|
44
70
|
Or install it yourself as:
|
45
71
|
|
46
|
-
|
72
|
+
```
|
73
|
+
gem install telegram-bot
|
74
|
+
```
|
47
75
|
|
48
76
|
Require if necessary:
|
49
77
|
|
@@ -170,19 +198,18 @@ Bot controllers like usual rails controllers provides features like callbacks,
|
|
170
198
|
|
171
199
|
```ruby
|
172
200
|
class Telegram::WebhookController < Telegram::Bot::UpdatesController
|
173
|
-
# use callbacks like in any other
|
201
|
+
# use callbacks like in any other controller
|
174
202
|
around_action :with_locale
|
175
203
|
|
176
|
-
# Every update
|
204
|
+
# Every update has one of: message, inline_query, chosen_inline_result,
|
177
205
|
# callback_query, etc.
|
178
|
-
# Define method with same name to
|
206
|
+
# Define method with the same name to handle this type of update.
|
179
207
|
def message(message)
|
180
|
-
# message can be also accessed via instance method
|
181
|
-
message == self.payload # true
|
182
208
|
# store_message(message['text'])
|
183
209
|
end
|
184
210
|
|
185
|
-
#
|
211
|
+
# For the following types of updates commonly used params are passed as arguments,
|
212
|
+
# full payload object is available with `payload` instance method.
|
186
213
|
#
|
187
214
|
# message(payload)
|
188
215
|
# inline_query(query, offset)
|
@@ -193,14 +220,19 @@ class Telegram::WebhookController < Telegram::Bot::UpdatesController
|
|
193
220
|
# Command arguments will be parsed and passed to the method.
|
194
221
|
# Be sure to use splat args and default values to not get errors when
|
195
222
|
# someone passed more or less arguments in the message.
|
196
|
-
def start!(
|
197
|
-
# do_smth_with(
|
223
|
+
def start!(word = nil, *other_words)
|
224
|
+
# do_smth_with(word)
|
225
|
+
|
226
|
+
# full message object is also available via `payload` instance method:
|
227
|
+
# process_raw_message(payload['text'])
|
198
228
|
|
199
229
|
# There are `chat` & `from` shortcut methods.
|
200
|
-
# For callback queries `chat`
|
230
|
+
# For callback queries `chat` is taken from `message` when it's available.
|
201
231
|
response = from ? "Hello #{from['username']}!" : 'Hi there!'
|
232
|
+
|
202
233
|
# There is `respond_with` helper to set `chat_id` from received message:
|
203
234
|
respond_with :message, text: response
|
235
|
+
|
204
236
|
# `reply_with` also sets `reply_to_message_id`:
|
205
237
|
reply_with :photo, photo: File.open('party.jpg')
|
206
238
|
end
|
@@ -223,10 +255,10 @@ end
|
|
223
255
|
|
224
256
|
#### Reply helpers
|
225
257
|
|
226
|
-
There are helpers
|
227
|
-
identifiers from update. See
|
258
|
+
There are helpers for basic responses. They just set chat/message/query
|
259
|
+
identifiers from the update. See
|
228
260
|
[`ReplyHelpers`](https://github.com/telegram-bot-rb/telegram-bot/blob/master/lib/telegram/bot/updates_controller/reply_helpers.rb)
|
229
|
-
module for more information. Here are
|
261
|
+
module for more information. Here are these methods signatures:
|
230
262
|
|
231
263
|
```ruby
|
232
264
|
def respond_with(type, params); end
|
@@ -389,7 +421,7 @@ telegram_webhook TelegramAuctionController, :auction
|
|
389
421
|
telegram_webhook TelegramController, as: :custom_telegram_webhook
|
390
422
|
```
|
391
423
|
|
392
|
-
####
|
424
|
+
#### Processing updates
|
393
425
|
|
394
426
|
To process update with controller call `.dispatch(bot, update)` on it.
|
395
427
|
There are several options to run it automatically:
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# Generated with bin/fetch-telegram-methods
|
2
|
-
# Bot API 5.
|
2
|
+
# Bot API 5.3
|
3
3
|
|
4
4
|
getUpdates
|
5
5
|
setWebhook
|
@@ -30,13 +30,16 @@ sendDice
|
|
30
30
|
sendChatAction
|
31
31
|
getUserProfilePhotos
|
32
32
|
getFile
|
33
|
-
|
33
|
+
banChatMember
|
34
34
|
unbanChatMember
|
35
35
|
restrictChatMember
|
36
36
|
promoteChatMember
|
37
37
|
setChatAdministratorCustomTitle
|
38
38
|
setChatPermissions
|
39
39
|
exportChatInviteLink
|
40
|
+
createChatInviteLink
|
41
|
+
editChatInviteLink
|
42
|
+
revokeChatInviteLink
|
40
43
|
setChatPhoto
|
41
44
|
deleteChatPhoto
|
42
45
|
setChatTitle
|
@@ -47,12 +50,13 @@ unpinAllChatMessages
|
|
47
50
|
leaveChat
|
48
51
|
getChat
|
49
52
|
getChatAdministrators
|
50
|
-
|
53
|
+
getChatMemberCount
|
51
54
|
getChatMember
|
52
55
|
setChatStickerSet
|
53
56
|
deleteChatStickerSet
|
54
57
|
answerCallbackQuery
|
55
58
|
setMyCommands
|
59
|
+
deleteMyCommands
|
56
60
|
getMyCommands
|
57
61
|
|
58
62
|
editMessageText
|
data/lib/telegram/bot/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: telegram-bot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.15.
|
4
|
+
version: 0.15.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Max Melentiev
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-06-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|