telegram-bot 0.14.1 → 0.14.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +0 -7
- data/CHANGELOG.md +8 -0
- data/README.md +6 -2
- data/lib/telegram/bot/client/api_methods.txt +3 -1
- data/lib/telegram/bot/updates_controller.rb +10 -14
- data/lib/telegram/bot/updates_controller/reply_helpers.rb +19 -2
- data/lib/telegram/bot/version.rb +1 -1
- data/telegram-bot.gemspec +1 -1
- metadata +5 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 465f75bf6ec9284a51b8c1a4b476b64255fadbf06bc76d4c102b295cef193f5a
|
4
|
+
data.tar.gz: 752b940dd722e18655fe353e58550c6cf7d1c16347f07879719c56152f0cde4f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 10e76c7013935584c3ad8bd8f8c73694a5b54dc20821e0bb4e78492f34f121ba28526766fcd2805d30df18683214f36f07e8d7f2b073a929ac987e9521375023
|
7
|
+
data.tar.gz: f1e2fea2b9f6a437c80d814ba91ac6eefe7c944bc5305083585d564d6b6e6c0639a98bd9ca8abcb42fe7383bd1c7f8cc24f2d6bca35826559804a816ffa00326
|
data/.travis.yml
CHANGED
@@ -25,10 +25,3 @@ matrix:
|
|
25
25
|
gemfile: gemfiles/rails_60.gemfile
|
26
26
|
notifications:
|
27
27
|
email: false
|
28
|
-
|
29
|
-
# for 2.5.0 until 2.5.1 is released:
|
30
|
-
# https://github.com/travis-ci/travis-ci/issues/8978
|
31
|
-
# https://github.com/travis-ci/travis-ci/issues/8969#issuecomment-354135622
|
32
|
-
before_install:
|
33
|
-
- gem update --system
|
34
|
-
- gem install bundler
|
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,16 @@
|
|
1
1
|
# Unreleased
|
2
2
|
|
3
|
+
# 0.14.2
|
4
|
+
|
5
|
+
- Add reply helpers: `answer_pre_checkout_query`, `answer_shipping_query`.
|
6
|
+
- Update to Bot API 4.3.
|
7
|
+
|
8
|
+
# 0.14.1
|
9
|
+
|
3
10
|
- Read config from secrets when credentials don't provide it in rails >= 5.2.
|
4
11
|
- Remove botan.io support. It's already shut down, so it should not be a braking change.
|
5
12
|
https://github.com/botanio/sdk#this-service-will-be-shut-down-on-25th-may-2018
|
13
|
+
- Update to Bot API 4.1.
|
6
14
|
|
7
15
|
# 0.14.0
|
8
16
|
|
data/README.md
CHANGED
@@ -100,10 +100,12 @@ development:
|
|
100
100
|
|
101
101
|
For Rails >= 5.2 `Telegram::Bot` searches for config first in credentials and then in secrets.
|
102
102
|
To use credentials as config store, add telegram section to credentials instead of secrets using
|
103
|
-
`rails credentials:edit`. In this case be aware of that [Rails may not load
|
103
|
+
`rails credentials:edit`. In this case be aware of that [Rails < 6.0 may not load
|
104
104
|
credentials in dev environment by default](https://github.com/telegram-bot-rb/telegram-bot/issues/74#issuecomment-384205609).
|
105
|
+
In Rails >= 6.0 run `rails credentials:edit --environment development` to configure bot
|
106
|
+
in each environment.
|
105
107
|
|
106
|
-
I suggest not using Rails 5.2 credentials because it can lead to leakage of
|
108
|
+
I suggest not using Rails 5.2 credentials because it can lead to leakage of sensitive data
|
107
109
|
and it's more difficult to use in multiple environments. See
|
108
110
|
[secure_credentials](https://github.com/printercu/secure_credentials) gem for better option.
|
109
111
|
|
@@ -229,6 +231,8 @@ def reply_with(type, params); end
|
|
229
231
|
def answer_inline_query(results, params = {}); end
|
230
232
|
def answer_callback_query(text, params = {}); end
|
231
233
|
def edit_message(type, params = {}); end
|
234
|
+
def answer_pre_checkout_query(ok, params = {}); end
|
235
|
+
def answer_shipping_query(ok, params = {}); end
|
232
236
|
```
|
233
237
|
|
234
238
|
#### Optional typecasting
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# Generated with bin/fetch-telegram-methods
|
2
|
-
# Bot API 4.
|
2
|
+
# Bot API 4.3
|
3
3
|
|
4
4
|
getUpdates
|
5
5
|
setWebhook
|
@@ -22,6 +22,7 @@ editMessageLiveLocation
|
|
22
22
|
stopMessageLiveLocation
|
23
23
|
sendVenue
|
24
24
|
sendContact
|
25
|
+
sendPoll
|
25
26
|
sendChatAction
|
26
27
|
getUserProfilePhotos
|
27
28
|
getFile
|
@@ -49,6 +50,7 @@ editMessageText
|
|
49
50
|
editMessageCaption
|
50
51
|
editMessageMedia
|
51
52
|
editMessageReplyMarkup
|
53
|
+
stopPoll
|
52
54
|
deleteMessage
|
53
55
|
|
54
56
|
sendSticker
|
@@ -7,13 +7,13 @@ module Telegram
|
|
7
7
|
module Bot
|
8
8
|
# Base class to create update processors. With callbacks, session and helpers.
|
9
9
|
#
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
10
|
+
# Public methods ending with `!` handle messages with commands.
|
11
|
+
# Message text is automatically parsed into method arguments.
|
12
|
+
# Be sure to use default values and
|
13
13
|
# splat arguments in every action method to not get errors, when user
|
14
14
|
# sends command without necessary args / with extra args.
|
15
15
|
#
|
16
|
-
# def start(token = nil, *)
|
16
|
+
# def start!(token = nil, *)
|
17
17
|
# if token
|
18
18
|
# # ...
|
19
19
|
# else
|
@@ -21,25 +21,21 @@ module Telegram
|
|
21
21
|
# end
|
22
22
|
# end
|
23
23
|
#
|
24
|
-
# def help(*)
|
24
|
+
# def help!(*)
|
25
25
|
# respond_with :message, text:
|
26
26
|
# end
|
27
27
|
#
|
28
28
|
# To process plain text messages (without commands) or other updates just
|
29
|
-
# define public method with name of payload type.
|
30
|
-
# as an argument
|
29
|
+
# define public method with name of payload type.
|
30
|
+
# By default they receive payload as an argument, but some of them are called
|
31
|
+
# with more usefuk args:
|
31
32
|
#
|
32
33
|
# def message(message)
|
33
34
|
# respond_with :message, text: "Echo: #{message['text']}"
|
34
35
|
# end
|
35
36
|
#
|
36
|
-
# def inline_query(query)
|
37
|
-
# answer_inline_query results_for_query(query), is_personal: true
|
38
|
-
# end
|
39
|
-
#
|
40
|
-
# # To process conflicting commands (`/message args`) just use `on_` prefix:
|
41
|
-
# def on_message(*args)
|
42
|
-
# # ...
|
37
|
+
# def inline_query(query, offset)
|
38
|
+
# answer_inline_query results_for_query(query, offset), is_personal: true
|
43
39
|
# end
|
44
40
|
#
|
45
41
|
# To process update run:
|
@@ -21,7 +21,7 @@ module Telegram
|
|
21
21
|
respond_with(type, params)
|
22
22
|
end
|
23
23
|
|
24
|
-
# Same as
|
24
|
+
# Same as respond_with, but for inline queries.
|
25
25
|
def answer_inline_query(results, params = {})
|
26
26
|
params = params.merge(
|
27
27
|
inline_query_id: payload['id'],
|
@@ -30,7 +30,7 @@ module Telegram
|
|
30
30
|
bot.answer_inline_query(params)
|
31
31
|
end
|
32
32
|
|
33
|
-
# Same as
|
33
|
+
# Same as respond_with, but for callback queries.
|
34
34
|
def answer_callback_query(text, params = {})
|
35
35
|
params = params.merge(
|
36
36
|
callback_query_id: payload['id'],
|
@@ -39,6 +39,23 @@ module Telegram
|
|
39
39
|
bot.answer_callback_query(params)
|
40
40
|
end
|
41
41
|
|
42
|
+
# Same as respond_with, but for pre checkout queries.
|
43
|
+
def answer_pre_checkout_query(ok, params = {})
|
44
|
+
params = params.merge(
|
45
|
+
pre_checkout_query_id: payload['id'],
|
46
|
+
ok: ok,
|
47
|
+
)
|
48
|
+
bot.answer_pre_checkout_query(params)
|
49
|
+
end
|
50
|
+
|
51
|
+
def answer_shipping_query(ok, params = {})
|
52
|
+
params = params.merge(
|
53
|
+
shipping_query_id: payload['id'],
|
54
|
+
ok: ok,
|
55
|
+
)
|
56
|
+
bot.answer_shipping_query(params)
|
57
|
+
end
|
58
|
+
|
42
59
|
# Edit message from callback query.
|
43
60
|
def edit_message(type, params = {})
|
44
61
|
params =
|
data/lib/telegram/bot/version.rb
CHANGED
data/telegram-bot.gemspec
CHANGED
@@ -26,6 +26,6 @@ Gem::Specification.new do |spec|
|
|
26
26
|
spec.add_dependency 'activesupport', '>= 4.0', '< 6.0'
|
27
27
|
spec.add_dependency 'httpclient', '~> 2.7'
|
28
28
|
|
29
|
-
spec.add_development_dependency 'bundler', '
|
29
|
+
spec.add_development_dependency 'bundler', '> 1.16'
|
30
30
|
spec.add_development_dependency 'rake', '~> 10.0'
|
31
31
|
end
|
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.14.
|
4
|
+
version: 0.14.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Max Melentiev
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-06-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|
@@ -68,14 +68,14 @@ dependencies:
|
|
68
68
|
name: bundler
|
69
69
|
requirement: !ruby/object:Gem::Requirement
|
70
70
|
requirements:
|
71
|
-
- - "
|
71
|
+
- - ">"
|
72
72
|
- !ruby/object:Gem::Version
|
73
73
|
version: '1.16'
|
74
74
|
type: :development
|
75
75
|
prerelease: false
|
76
76
|
version_requirements: !ruby/object:Gem::Requirement
|
77
77
|
requirements:
|
78
|
-
- - "
|
78
|
+
- - ">"
|
79
79
|
- !ruby/object:Gem::Version
|
80
80
|
version: '1.16'
|
81
81
|
- !ruby/object:Gem::Dependency
|
@@ -178,8 +178,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
178
178
|
- !ruby/object:Gem::Version
|
179
179
|
version: '0'
|
180
180
|
requirements: []
|
181
|
-
|
182
|
-
rubygems_version: 2.7.6
|
181
|
+
rubygems_version: 3.0.3
|
183
182
|
signing_key:
|
184
183
|
specification_version: 4
|
185
184
|
summary: Library for building Telegram Bots with Rails integration
|