зеркало из
https://github.com/glebtv/telegram-bot.git
synced 2026-09-03 17:55:52 +03:00
Сравнить коммиты
6 Коммитов
| Автор | SHA1 | Дата | |
|---|---|---|---|
|
|
cb973d90dc | ||
|
|
7c3002266a | ||
|
|
814c4e7d1a | ||
|
|
42b98dbf40 | ||
|
|
225e02abb4 | ||
|
|
084ff3527b |
4
.github/workflows/ci.yml
поставляемый
4
.github/workflows/ci.yml
поставляемый
@@ -26,6 +26,10 @@ jobs:
|
|||||||
- gemfiles/rails_51.gemfile
|
- gemfiles/rails_51.gemfile
|
||||||
include:
|
include:
|
||||||
# ruby 3.x
|
# ruby 3.x
|
||||||
|
- ruby: '3.2'
|
||||||
|
gemfile: gemfiles/rails_80.gemfile
|
||||||
|
- ruby: '3.2'
|
||||||
|
gemfile: gemfiles/rails_72.gemfile
|
||||||
- ruby: '3.2'
|
- ruby: '3.2'
|
||||||
gemfile: gemfiles/rails_71.gemfile
|
gemfile: gemfiles/rails_71.gemfile
|
||||||
- ruby: '3.0'
|
- ruby: '3.0'
|
||||||
|
|||||||
10
Appraisals
10
Appraisals
@@ -1,5 +1,15 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
appraise 'rails-80' do
|
||||||
|
gem 'actionpack', '~> 8.0.0'
|
||||||
|
gem 'railties', '~> 8.0.0'
|
||||||
|
end
|
||||||
|
|
||||||
|
appraise 'rails-72' do
|
||||||
|
gem 'actionpack', '~> 7.2.0'
|
||||||
|
gem 'railties', '~> 7.2.0'
|
||||||
|
end
|
||||||
|
|
||||||
appraise 'rails-71' do
|
appraise 'rails-71' do
|
||||||
gem 'actionpack', '~> 7.1.0'
|
gem 'actionpack', '~> 7.1.0'
|
||||||
gem 'railties', '~> 7.1.0'
|
gem 'railties', '~> 7.1.0'
|
||||||
|
|||||||
18
CHANGELOG.md
18
CHANGELOG.md
@@ -1,5 +1,23 @@
|
|||||||
# Unreleased
|
# Unreleased
|
||||||
|
|
||||||
|
# 0.16.7
|
||||||
|
|
||||||
|
- Update to Bot API 8.2
|
||||||
|
|
||||||
|
# 0.16.6
|
||||||
|
|
||||||
|
- Fix poller rake task for Rails 8.0
|
||||||
|
|
||||||
|
# 0.16.5
|
||||||
|
|
||||||
|
- Rails 8.0 support
|
||||||
|
- Update to Bot API 8.0
|
||||||
|
|
||||||
|
# 0.16.4
|
||||||
|
|
||||||
|
- Rails 7.2 support
|
||||||
|
- Update to Bot API 7.9
|
||||||
|
|
||||||
# 0.16.3
|
# 0.16.3
|
||||||
|
|
||||||
- Update to Bot API 7.7
|
- Update to Bot API 7.7
|
||||||
|
|||||||
@@ -41,3 +41,24 @@ puts result_txt
|
|||||||
API_METHODS_FILE = File.expand_path('../lib/telegram/bot/client/api_methods.txt', __dir__).freeze
|
API_METHODS_FILE = File.expand_path('../lib/telegram/bot/client/api_methods.txt', __dir__).freeze
|
||||||
File.write(API_METHODS_FILE, result_txt)
|
File.write(API_METHODS_FILE, result_txt)
|
||||||
puts '', "Updated #{API_METHODS_FILE}"
|
puts '', "Updated #{API_METHODS_FILE}"
|
||||||
|
|
||||||
|
|
||||||
|
puts '', 'Payload types:'
|
||||||
|
update_tbody = doc.css('tbody').
|
||||||
|
find { |tbody| tbody.css('td').any? { |td| td.text == 'update_id' } }
|
||||||
|
payload_types = update_tbody.css('td:first-child').map(&:text).reject { |x| x == 'update_id' }
|
||||||
|
|
||||||
|
result = ['# Generated with bin/fetch-telegram-methods']
|
||||||
|
result << "# #{api_version[1]}" if api_version
|
||||||
|
result << payload_types.join("\n")
|
||||||
|
result << ''
|
||||||
|
result_txt = result.join("\n")
|
||||||
|
|
||||||
|
puts result_txt
|
||||||
|
|
||||||
|
PAYLOAD_TYPES_FILE = File.expand_path(
|
||||||
|
'../lib/telegram/bot/updates_controller/payload_types.txt',
|
||||||
|
__dir__,
|
||||||
|
).freeze
|
||||||
|
File.write(PAYLOAD_TYPES_FILE, result_txt)
|
||||||
|
puts '', "Updated #{PAYLOAD_TYPES_FILE}"
|
||||||
|
|||||||
21
gemfiles/rails_72.gemfile
Обычный файл
21
gemfiles/rails_72.gemfile
Обычный файл
@@ -0,0 +1,21 @@
|
|||||||
|
# This file was generated by Appraisal
|
||||||
|
|
||||||
|
source "https://rubygems.org"
|
||||||
|
|
||||||
|
gem "actionpack", "~> 7.2.0"
|
||||||
|
gem "railties", "~> 7.2.0"
|
||||||
|
|
||||||
|
group :development do
|
||||||
|
gem "appraisal", "~> 2.2"
|
||||||
|
gem "debug", "~> 1.9.2"
|
||||||
|
gem "sdoc", "~> 2.0.3"
|
||||||
|
gem "telegram-bot-types", "~> 0.6.3"
|
||||||
|
gem "rspec", "~> 3.12.0"
|
||||||
|
gem "rspec-its", "~> 1.3.0"
|
||||||
|
gem "rspec-rails", "~> 4.0.2"
|
||||||
|
gem "rubocop", "~> 1.59.0"
|
||||||
|
gem "rubocop-rails", "~> 2.23.1"
|
||||||
|
gem "coveralls", "~> 0.8.23", require: false
|
||||||
|
end
|
||||||
|
|
||||||
|
gemspec path: "../"
|
||||||
21
gemfiles/rails_80.gemfile
Обычный файл
21
gemfiles/rails_80.gemfile
Обычный файл
@@ -0,0 +1,21 @@
|
|||||||
|
# This file was generated by Appraisal
|
||||||
|
|
||||||
|
source "https://rubygems.org"
|
||||||
|
|
||||||
|
gem "actionpack", "~> 8.0.0"
|
||||||
|
gem "railties", "~> 8.0.0"
|
||||||
|
|
||||||
|
group :development do
|
||||||
|
gem "appraisal", "~> 2.2"
|
||||||
|
gem "debug", "~> 1.9.2"
|
||||||
|
gem "sdoc", "~> 2.0.3"
|
||||||
|
gem "telegram-bot-types", "~> 0.6.3"
|
||||||
|
gem "rspec", "~> 3.12.0"
|
||||||
|
gem "rspec-its", "~> 1.3.0"
|
||||||
|
gem "rspec-rails", "~> 4.0.2"
|
||||||
|
gem "rubocop", "~> 1.59.0"
|
||||||
|
gem "rubocop-rails", "~> 2.23.1"
|
||||||
|
gem "coveralls", "~> 0.8.23", require: false
|
||||||
|
end
|
||||||
|
|
||||||
|
gemspec path: "../"
|
||||||
@@ -15,6 +15,9 @@ namespace :telegram do
|
|||||||
Rails.logger.extend ActiveSupport::Logger.broadcast console
|
Rails.logger.extend ActiveSupport::Logger.broadcast console
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
# Routes are not loaded by default in Rails >= 8.0.
|
||||||
|
# Load them explicitly to identify a controller for a bot.
|
||||||
|
Rails.application.try(:reload_routes_unless_loaded)
|
||||||
Telegram::Bot::UpdatesPoller.start(ENV['BOT']&.to_sym || :default)
|
Telegram::Bot::UpdatesPoller.start(ENV['BOT']&.to_sym || :default)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# Generated with bin/fetch-telegram-methods
|
# Generated with bin/fetch-telegram-methods
|
||||||
# Bot API 7.7
|
# Bot API 8.2
|
||||||
|
|
||||||
getUpdates
|
getUpdates
|
||||||
setWebhook
|
setWebhook
|
||||||
@@ -31,6 +31,7 @@ sendDice
|
|||||||
sendChatAction
|
sendChatAction
|
||||||
setMessageReaction
|
setMessageReaction
|
||||||
getUserProfilePhotos
|
getUserProfilePhotos
|
||||||
|
setUserEmojiStatus
|
||||||
getFile
|
getFile
|
||||||
banChatMember
|
banChatMember
|
||||||
unbanChatMember
|
unbanChatMember
|
||||||
@@ -43,6 +44,8 @@ setChatPermissions
|
|||||||
exportChatInviteLink
|
exportChatInviteLink
|
||||||
createChatInviteLink
|
createChatInviteLink
|
||||||
editChatInviteLink
|
editChatInviteLink
|
||||||
|
createChatSubscriptionInviteLink
|
||||||
|
editChatSubscriptionInviteLink
|
||||||
revokeChatInviteLink
|
revokeChatInviteLink
|
||||||
approveChatJoinRequest
|
approveChatJoinRequest
|
||||||
declineChatJoinRequest
|
declineChatJoinRequest
|
||||||
@@ -116,9 +119,16 @@ setStickerSetTitle
|
|||||||
setStickerSetThumbnail
|
setStickerSetThumbnail
|
||||||
setCustomEmojiStickerSetThumbnail
|
setCustomEmojiStickerSetThumbnail
|
||||||
deleteStickerSet
|
deleteStickerSet
|
||||||
|
getAvailableGifts
|
||||||
|
sendGift
|
||||||
|
verifyUser
|
||||||
|
verifyChat
|
||||||
|
removeUserVerification
|
||||||
|
removeChatVerification
|
||||||
|
|
||||||
answerInlineQuery
|
answerInlineQuery
|
||||||
answerWebAppQuery
|
answerWebAppQuery
|
||||||
|
savePreparedInlineMessage
|
||||||
|
|
||||||
sendInvoice
|
sendInvoice
|
||||||
createInvoiceLink
|
createInvoiceLink
|
||||||
@@ -126,6 +136,7 @@ answerShippingQuery
|
|||||||
answerPreCheckoutQuery
|
answerPreCheckoutQuery
|
||||||
getStarTransactions
|
getStarTransactions
|
||||||
refundStarPayment
|
refundStarPayment
|
||||||
|
editUserStarSubscription
|
||||||
|
|
||||||
setPassportDataErrors
|
setPassportDataErrors
|
||||||
|
|
||||||
|
|||||||
@@ -89,31 +89,13 @@ module Telegram
|
|||||||
|
|
||||||
extend Session::ConfigMethods
|
extend Session::ConfigMethods
|
||||||
|
|
||||||
PAYLOAD_TYPES = Set.new(%w[
|
PAYLOAD_TYPES_FILE = File.expand_path('updates_controller/payload_types.txt', __dir__)
|
||||||
message
|
PAYLOAD_TYPES = File.read(PAYLOAD_TYPES_FILE).
|
||||||
edited_message
|
lines.
|
||||||
channel_post
|
map(&:strip).
|
||||||
edited_channel_post
|
reject { |x| x.empty? || x.start_with?('#') }.
|
||||||
business_connection
|
to_set.
|
||||||
business_message
|
freeze
|
||||||
edited_business_message
|
|
||||||
deleted_business_messages
|
|
||||||
message_reaction
|
|
||||||
message_reaction_count
|
|
||||||
inline_query
|
|
||||||
chosen_inline_result
|
|
||||||
callback_query
|
|
||||||
shipping_query
|
|
||||||
pre_checkout_query
|
|
||||||
poll
|
|
||||||
poll_answer
|
|
||||||
my_chat_member
|
|
||||||
chat_member
|
|
||||||
chat_join_request
|
|
||||||
chat_boost
|
|
||||||
removed_chat_boost
|
|
||||||
pre_checkout_query
|
|
||||||
].freeze)
|
|
||||||
|
|
||||||
class << self
|
class << self
|
||||||
# Initialize controller and process update.
|
# Initialize controller and process update.
|
||||||
|
|||||||
25
lib/telegram/bot/updates_controller/payload_types.txt
Обычный файл
25
lib/telegram/bot/updates_controller/payload_types.txt
Обычный файл
@@ -0,0 +1,25 @@
|
|||||||
|
# Generated with bin/fetch-telegram-methods
|
||||||
|
# Bot API 8.2
|
||||||
|
message
|
||||||
|
edited_message
|
||||||
|
channel_post
|
||||||
|
edited_channel_post
|
||||||
|
business_connection
|
||||||
|
business_message
|
||||||
|
edited_business_message
|
||||||
|
deleted_business_messages
|
||||||
|
message_reaction
|
||||||
|
message_reaction_count
|
||||||
|
inline_query
|
||||||
|
chosen_inline_result
|
||||||
|
callback_query
|
||||||
|
shipping_query
|
||||||
|
pre_checkout_query
|
||||||
|
purchased_paid_media
|
||||||
|
poll
|
||||||
|
poll_answer
|
||||||
|
my_chat_member
|
||||||
|
chat_member
|
||||||
|
chat_join_request
|
||||||
|
chat_boost
|
||||||
|
removed_chat_boost
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
module Telegram
|
module Telegram
|
||||||
module Bot
|
module Bot
|
||||||
VERSION = '0.16.3'
|
VERSION = '0.16.7'
|
||||||
|
|
||||||
def self.gem_version
|
def self.gem_version
|
||||||
Gem::Version.new VERSION
|
Gem::Version.new VERSION
|
||||||
|
|||||||
@@ -15,7 +15,12 @@ ENV['RAILS_ENV'] = 'test'
|
|||||||
class TestApplication < Rails::Application
|
class TestApplication < Rails::Application
|
||||||
config.eager_load = false
|
config.eager_load = false
|
||||||
config.log_level = :debug
|
config.log_level = :debug
|
||||||
config.action_dispatch.show_exceptions = false
|
if (ActionPack::VERSION::MAJOR >= 8) ||
|
||||||
|
(ActionPack::VERSION::MAJOR == 7 && ActionPack::VERSION::MINOR >= 2)
|
||||||
|
config.action_dispatch.show_exceptions = :none
|
||||||
|
else
|
||||||
|
config.action_dispatch.show_exceptions = false
|
||||||
|
end
|
||||||
routes.default_url_options = {host: 'test.rpsec'}
|
routes.default_url_options = {host: 'test.rpsec'}
|
||||||
|
|
||||||
telegram_config = {
|
telegram_config = {
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ RSpec.describe Telegram::Bot::UpdatesController::TypedUpdate do
|
|||||||
message_reaction_count
|
message_reaction_count
|
||||||
chat_boost
|
chat_boost
|
||||||
removed_chat_boost
|
removed_chat_boost
|
||||||
|
purchased_paid_media
|
||||||
pre_checkout_query
|
pre_checkout_query
|
||||||
]).
|
]).
|
||||||
map { |x| [x, Telegram::Bot::Types.const_get(x.camelize)] }.to_h.
|
map { |x| [x, Telegram::Bot::Types.const_get(x.camelize)] }.to_h.
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ Gem::Specification.new do |spec|
|
|||||||
|
|
||||||
spec.required_ruby_version = '>= 2.4'
|
spec.required_ruby_version = '>= 2.4'
|
||||||
|
|
||||||
spec.add_dependency 'actionpack', '>= 4.0', '< 7.2'
|
spec.add_dependency 'actionpack', '>= 4.0', '< 8.1'
|
||||||
spec.add_dependency 'activesupport', '>= 4.0', '< 7.2'
|
spec.add_dependency 'activesupport', '>= 4.0', '< 8.1'
|
||||||
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'
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user