1
0
зеркало из https://github.com/glebtv/telegram-bot.git synced 2026-08-28 15:26:18 +03:00

Сравнить коммиты

...

11 Коммитов

Автор SHA1 Сообщение Дата
Max Melentiev
ca4ea9e6cb v0.14.2 2019-06-30 21:15:53 +03:00
Max Melentiev
68ec0257bd Add note on editing rails 6.0 credential 2019-06-30 21:10:22 +03:00
Max Melentiev
b50bd30137 Add methods from api v4.3 2019-06-30 20:57:50 +03:00
Max Melentiev
80362da270 Add answer_shipping_query helper 2019-06-30 20:56:41 +03:00
Muhammad Nuzaihan Bin Kamal Luddin
294d762785 Add answer_pre_checkout_query helper (#118) 2019-06-30 20:39:43 +03:00
printercu
1cb3265371 Merge pull request #113 from telegram-bot-rb/fix_travis
Remove workaround for ruby 2.5.0 to fix travis builds
2019-02-15 20:03:31 +05:30
Max Melentiev
c44529725f Relax bundler dependency 2019-02-15 19:46:01 +05:30
Max Melentiev
fa43561765 Remove workaround for ruby 2.5.0 to fix travis builds 2019-02-15 19:27:18 +05:30
printercu
cea856c928 Merge pull request #110 from biow0lf/master
Fix typo
2019-02-15 19:25:32 +05:30
Igor Zubkov
5a93c1efc6 Fix typo 2019-01-24 03:47:05 +02:00
Max Melentiev
38ee303912 Fix doc-comment for latest changes 2018-09-23 10:39:56 +03:00
8 изменённых файлов: 48 добавлений и 28 удалений

Просмотреть файл

@@ -25,10 +25,3 @@ matrix:
gemfile: gemfiles/rails_60.gemfile
notifications:
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
# 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.
- 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
- Update to Bot API 4.1.
# 0.14.0

Просмотреть файл

@@ -100,10 +100,12 @@ development:
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
`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).
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
[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_callback_query(text, 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

Просмотреть файл

@@ -1,5 +1,5 @@
# Generated with bin/fetch-telegram-methods
# Bot API 4.1
# Bot API 4.3
getUpdates
setWebhook
@@ -22,6 +22,7 @@ editMessageLiveLocation
stopMessageLiveLocation
sendVenue
sendContact
sendPoll
sendChatAction
getUserProfilePhotos
getFile
@@ -49,6 +50,7 @@ editMessageText
editMessageCaption
editMessageMedia
editMessageReplyMarkup
stopPoll
deleteMessage
sendSticker

Просмотреть файл

@@ -7,13 +7,13 @@ module Telegram
module Bot
# Base class to create update processors. With callbacks, session and helpers.
#
# Define public methods for each command and they will be called when
# update has this command. Message is automatically parsed and
# words are passed as method arguments. Be sure to use default values and
# Public methods ending with `!` handle messages with commands.
# Message text is automatically parsed into method arguments.
# Be sure to use default values and
# splat arguments in every action method to not get errors, when user
# sends command without necessary args / with extra args.
#
# def start(token = nil, *)
# def start!(token = nil, *)
# if token
# # ...
# else
@@ -21,25 +21,21 @@ module Telegram
# end
# end
#
# def help(*)
# def help!(*)
# respond_with :message, text:
# end
#
# To process plain text messages (without commands) or other updates just
# define public method with name of payload type. They will receive payload
# as an argument.
# define public method with name of payload type.
# By default they receive payload as an argument, but some of them are called
# with more usefuk args:
#
# def message(message)
# respond_with :message, text: "Echo: #{message['text']}"
# end
#
# def inline_query(query)
# answer_inline_query results_for_query(query), is_personal: true
# end
#
# # To process conflicting commands (`/message args`) just use `on_` prefix:
# def on_message(*args)
# # ...
# def inline_query(query, offset)
# answer_inline_query results_for_query(query, offset), is_personal: true
# end
#
# To process update run:

Просмотреть файл

@@ -21,7 +21,7 @@ module Telegram
respond_with(type, params)
end
# Same as reply_with, but for inline queries.
# Same as respond_with, but for inline queries.
def answer_inline_query(results, params = {})
params = params.merge(
inline_query_id: payload['id'],
@@ -30,7 +30,7 @@ module Telegram
bot.answer_inline_query(params)
end
# Same as reply_with, but for callback queries.
# Same as respond_with, but for callback queries.
def answer_callback_query(text, params = {})
params = params.merge(
callback_query_id: payload['id'],
@@ -39,6 +39,23 @@ module Telegram
bot.answer_callback_query(params)
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.
def edit_message(type, params = {})
params =

Просмотреть файл

@@ -1,6 +1,6 @@
module Telegram
module Bot
VERSION = '0.14.1'.freeze
VERSION = '0.14.2'.freeze
def self.gem_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 'httpclient', '~> 2.7'
spec.add_development_dependency 'bundler', '~> 1.16'
spec.add_development_dependency 'bundler', '> 1.16'
spec.add_development_dependency 'rake', '~> 10.0'
end