зеркало из
https://github.com/glebtv/telegram-bot.git
synced 2026-09-03 17:55:52 +03:00
Сравнить коммиты
11 Коммитов
| Автор | SHA1 | Дата | |
|---|---|---|---|
|
|
ca4ea9e6cb | ||
|
|
68ec0257bd | ||
|
|
b50bd30137 | ||
|
|
80362da270 | ||
|
|
294d762785 | ||
|
|
1cb3265371 | ||
|
|
c44529725f | ||
|
|
fa43561765 | ||
|
|
cea856c928 | ||
|
|
5a93c1efc6 | ||
|
|
38ee303912 |
@@ -25,10 +25,3 @@ matrix:
|
|||||||
gemfile: gemfiles/rails_60.gemfile
|
gemfile: gemfiles/rails_60.gemfile
|
||||||
notifications:
|
notifications:
|
||||||
email: false
|
email: false
|
||||||
|
|
||||||
# for 2.5.0 until 2.5.1 is released:
|
|
||||||
# https://github.com/travis-ci/travis-ci/issues/8978
|
|
||||||
# https://github.com/travis-ci/travis-ci/issues/8969#issuecomment-354135622
|
|
||||||
before_install:
|
|
||||||
- gem update --system
|
|
||||||
- gem install bundler
|
|
||||||
|
|||||||
@@ -1,8 +1,16 @@
|
|||||||
# Unreleased
|
# Unreleased
|
||||||
|
|
||||||
|
# 0.14.2
|
||||||
|
|
||||||
|
- Add reply helpers: `answer_pre_checkout_query`, `answer_shipping_query`.
|
||||||
|
- Update to Bot API 4.3.
|
||||||
|
|
||||||
|
# 0.14.1
|
||||||
|
|
||||||
- Read config from secrets when credentials don't provide it in rails >= 5.2.
|
- Read config from secrets when credentials don't provide it in rails >= 5.2.
|
||||||
- Remove botan.io support. It's already shut down, so it should not be a braking change.
|
- Remove botan.io support. It's already shut down, so it should not be a braking change.
|
||||||
https://github.com/botanio/sdk#this-service-will-be-shut-down-on-25th-may-2018
|
https://github.com/botanio/sdk#this-service-will-be-shut-down-on-25th-may-2018
|
||||||
|
- Update to Bot API 4.1.
|
||||||
|
|
||||||
# 0.14.0
|
# 0.14.0
|
||||||
|
|
||||||
|
|||||||
@@ -100,10 +100,12 @@ development:
|
|||||||
|
|
||||||
For Rails >= 5.2 `Telegram::Bot` searches for config first in credentials and then in secrets.
|
For Rails >= 5.2 `Telegram::Bot` searches for config first in credentials and then in secrets.
|
||||||
To use credentials as config store, add telegram section to credentials instead of secrets using
|
To use credentials as config store, add telegram section to credentials instead of secrets using
|
||||||
`rails credentials:edit`. In this case be aware of that [Rails may not load
|
`rails credentials:edit`. In this case be aware of that [Rails < 6.0 may not load
|
||||||
credentials in dev environment by default](https://github.com/telegram-bot-rb/telegram-bot/issues/74#issuecomment-384205609).
|
credentials in dev environment by default](https://github.com/telegram-bot-rb/telegram-bot/issues/74#issuecomment-384205609).
|
||||||
|
In Rails >= 6.0 run `rails credentials:edit --environment development` to configure bot
|
||||||
|
in each environment.
|
||||||
|
|
||||||
I suggest not using Rails 5.2 credentials because it can lead to leakage of sesitive data
|
I suggest not using Rails 5.2 credentials because it can lead to leakage of sensitive data
|
||||||
and it's more difficult to use in multiple environments. See
|
and it's more difficult to use in multiple environments. See
|
||||||
[secure_credentials](https://github.com/printercu/secure_credentials) gem for better option.
|
[secure_credentials](https://github.com/printercu/secure_credentials) gem for better option.
|
||||||
|
|
||||||
@@ -229,6 +231,8 @@ def reply_with(type, params); end
|
|||||||
def answer_inline_query(results, params = {}); end
|
def answer_inline_query(results, params = {}); end
|
||||||
def answer_callback_query(text, params = {}); end
|
def answer_callback_query(text, params = {}); end
|
||||||
def edit_message(type, params = {}); end
|
def edit_message(type, params = {}); end
|
||||||
|
def answer_pre_checkout_query(ok, params = {}); end
|
||||||
|
def answer_shipping_query(ok, params = {}); end
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Optional typecasting
|
#### Optional typecasting
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# Generated with bin/fetch-telegram-methods
|
# Generated with bin/fetch-telegram-methods
|
||||||
# Bot API 4.1
|
# Bot API 4.3
|
||||||
|
|
||||||
getUpdates
|
getUpdates
|
||||||
setWebhook
|
setWebhook
|
||||||
@@ -22,6 +22,7 @@ editMessageLiveLocation
|
|||||||
stopMessageLiveLocation
|
stopMessageLiveLocation
|
||||||
sendVenue
|
sendVenue
|
||||||
sendContact
|
sendContact
|
||||||
|
sendPoll
|
||||||
sendChatAction
|
sendChatAction
|
||||||
getUserProfilePhotos
|
getUserProfilePhotos
|
||||||
getFile
|
getFile
|
||||||
@@ -49,6 +50,7 @@ editMessageText
|
|||||||
editMessageCaption
|
editMessageCaption
|
||||||
editMessageMedia
|
editMessageMedia
|
||||||
editMessageReplyMarkup
|
editMessageReplyMarkup
|
||||||
|
stopPoll
|
||||||
deleteMessage
|
deleteMessage
|
||||||
|
|
||||||
sendSticker
|
sendSticker
|
||||||
|
|||||||
@@ -7,13 +7,13 @@ module Telegram
|
|||||||
module Bot
|
module Bot
|
||||||
# Base class to create update processors. With callbacks, session and helpers.
|
# Base class to create update processors. With callbacks, session and helpers.
|
||||||
#
|
#
|
||||||
# Define public methods for each command and they will be called when
|
# Public methods ending with `!` handle messages with commands.
|
||||||
# update has this command. Message is automatically parsed and
|
# Message text is automatically parsed into method arguments.
|
||||||
# words are passed as method arguments. Be sure to use default values and
|
# Be sure to use default values and
|
||||||
# splat arguments in every action method to not get errors, when user
|
# splat arguments in every action method to not get errors, when user
|
||||||
# sends command without necessary args / with extra args.
|
# sends command without necessary args / with extra args.
|
||||||
#
|
#
|
||||||
# def start(token = nil, *)
|
# def start!(token = nil, *)
|
||||||
# if token
|
# if token
|
||||||
# # ...
|
# # ...
|
||||||
# else
|
# else
|
||||||
@@ -21,25 +21,21 @@ module Telegram
|
|||||||
# end
|
# end
|
||||||
# end
|
# end
|
||||||
#
|
#
|
||||||
# def help(*)
|
# def help!(*)
|
||||||
# respond_with :message, text:
|
# respond_with :message, text:
|
||||||
# end
|
# end
|
||||||
#
|
#
|
||||||
# To process plain text messages (without commands) or other updates just
|
# To process plain text messages (without commands) or other updates just
|
||||||
# define public method with name of payload type. They will receive payload
|
# define public method with name of payload type.
|
||||||
# as an argument.
|
# By default they receive payload as an argument, but some of them are called
|
||||||
|
# with more usefuk args:
|
||||||
#
|
#
|
||||||
# def message(message)
|
# def message(message)
|
||||||
# respond_with :message, text: "Echo: #{message['text']}"
|
# respond_with :message, text: "Echo: #{message['text']}"
|
||||||
# end
|
# end
|
||||||
#
|
#
|
||||||
# def inline_query(query)
|
# def inline_query(query, offset)
|
||||||
# answer_inline_query results_for_query(query), is_personal: true
|
# answer_inline_query results_for_query(query, offset), is_personal: true
|
||||||
# end
|
|
||||||
#
|
|
||||||
# # To process conflicting commands (`/message args`) just use `on_` prefix:
|
|
||||||
# def on_message(*args)
|
|
||||||
# # ...
|
|
||||||
# end
|
# end
|
||||||
#
|
#
|
||||||
# To process update run:
|
# To process update run:
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ module Telegram
|
|||||||
respond_with(type, params)
|
respond_with(type, params)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Same as reply_with, but for inline queries.
|
# Same as respond_with, but for inline queries.
|
||||||
def answer_inline_query(results, params = {})
|
def answer_inline_query(results, params = {})
|
||||||
params = params.merge(
|
params = params.merge(
|
||||||
inline_query_id: payload['id'],
|
inline_query_id: payload['id'],
|
||||||
@@ -30,7 +30,7 @@ module Telegram
|
|||||||
bot.answer_inline_query(params)
|
bot.answer_inline_query(params)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Same as reply_with, but for callback queries.
|
# Same as respond_with, but for callback queries.
|
||||||
def answer_callback_query(text, params = {})
|
def answer_callback_query(text, params = {})
|
||||||
params = params.merge(
|
params = params.merge(
|
||||||
callback_query_id: payload['id'],
|
callback_query_id: payload['id'],
|
||||||
@@ -39,6 +39,23 @@ module Telegram
|
|||||||
bot.answer_callback_query(params)
|
bot.answer_callback_query(params)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Same as respond_with, but for pre checkout queries.
|
||||||
|
def answer_pre_checkout_query(ok, params = {})
|
||||||
|
params = params.merge(
|
||||||
|
pre_checkout_query_id: payload['id'],
|
||||||
|
ok: ok,
|
||||||
|
)
|
||||||
|
bot.answer_pre_checkout_query(params)
|
||||||
|
end
|
||||||
|
|
||||||
|
def answer_shipping_query(ok, params = {})
|
||||||
|
params = params.merge(
|
||||||
|
shipping_query_id: payload['id'],
|
||||||
|
ok: ok,
|
||||||
|
)
|
||||||
|
bot.answer_shipping_query(params)
|
||||||
|
end
|
||||||
|
|
||||||
# Edit message from callback query.
|
# Edit message from callback query.
|
||||||
def edit_message(type, params = {})
|
def edit_message(type, params = {})
|
||||||
params =
|
params =
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
module Telegram
|
module Telegram
|
||||||
module Bot
|
module Bot
|
||||||
VERSION = '0.14.1'.freeze
|
VERSION = '0.14.2'.freeze
|
||||||
|
|
||||||
def self.gem_version
|
def self.gem_version
|
||||||
Gem::Version.new VERSION
|
Gem::Version.new VERSION
|
||||||
|
|||||||
@@ -26,6 +26,6 @@ Gem::Specification.new do |spec|
|
|||||||
spec.add_dependency 'activesupport', '>= 4.0', '< 6.0'
|
spec.add_dependency 'activesupport', '>= 4.0', '< 6.0'
|
||||||
spec.add_dependency 'httpclient', '~> 2.7'
|
spec.add_dependency 'httpclient', '~> 2.7'
|
||||||
|
|
||||||
spec.add_development_dependency 'bundler', '~> 1.16'
|
spec.add_development_dependency 'bundler', '> 1.16'
|
||||||
spec.add_development_dependency 'rake', '~> 10.0'
|
spec.add_development_dependency 'rake', '~> 10.0'
|
||||||
end
|
end
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user