зеркало из
https://github.com/glebtv/telegram-bot.git
synced 2026-08-28 15:26:18 +03:00
Сравнить коммиты
7 Коммитов
| Автор | SHA1 | Дата | |
|---|---|---|---|
|
|
f61cc1e536 | ||
|
|
2f7ff9d50e | ||
|
|
aca35a1934 | ||
|
|
5bf98b419b | ||
|
|
8077ef9bcf | ||
|
|
5fef6fb43a | ||
|
|
07be01c07d |
10
CHANGELOG.md
10
CHANGELOG.md
@@ -1,4 +1,12 @@
|
||||
# 0.7.1
|
||||
# 0.7.4
|
||||
|
||||
- Rails 5 support by @dreyks (#4).
|
||||
|
||||
# 0.7.3
|
||||
|
||||
- Fixed issues with poller in production (#3)
|
||||
|
||||
# 0.7.2
|
||||
|
||||
- Bot API 2.1
|
||||
- Fixed possible crashes when payload type is not supported.
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
namespace :telegram do
|
||||
namespace :bot do
|
||||
desc 'Run poller'
|
||||
task poller: :environment do
|
||||
console = ActiveSupport::Logger.new(STDERR)
|
||||
Rails.logger.extend ActiveSupport::Logger.broadcast console
|
||||
desc 'Run poller. It broadcasts Rails.logger to STDOUT in dev like `rails s` do. ' \
|
||||
'Use LOG_TO_STDOUT to enable/disable broadcasting.'
|
||||
task :poller do
|
||||
ENV['BOT_POLLER_MODE'] = 'true'
|
||||
Rake::Task['environment'].invoke
|
||||
if ENV.fetch('LOG_TO_STDOUT') { Rails.env.development? }.present?
|
||||
console = ActiveSupport::Logger.new(STDERR)
|
||||
Rails.logger.extend ActiveSupport::Logger.broadcast console
|
||||
end
|
||||
Telegram::Bot::UpdatesPoller.start(ENV['BOT'].try!(:to_sym) || :default)
|
||||
end
|
||||
|
||||
|
||||
@@ -71,11 +71,16 @@ module Telegram
|
||||
answerCallbackQuery
|
||||
answerInlineQuery
|
||||
forwardMessage
|
||||
getChat
|
||||
getChatAdministrators
|
||||
getChatMember
|
||||
getChatMembersCount
|
||||
getFile
|
||||
getMe
|
||||
getUpdates
|
||||
getUserProfilePhotos
|
||||
kickChatMember
|
||||
leaveChat
|
||||
sendAudio
|
||||
sendChatAction
|
||||
sendContact
|
||||
|
||||
@@ -14,9 +14,14 @@ module Telegram
|
||||
# It just tells routes helpers whether to add routed bots to
|
||||
# Bot::UpdatesPoller, so their config will be available by bot key in
|
||||
# Bot::UpdatesPoller.start.
|
||||
#
|
||||
# It's enabled by default in Rails dev environment and `rake telegram:bot:poller`
|
||||
# task. Use `BOT_POLLER_MODE=true` envvar to set it manually.
|
||||
def bot_poller_mode?
|
||||
return @bot_poller_mode if defined?(@bot_poller_mode)
|
||||
Rails.env.development? if defined?(Rails)
|
||||
@bot_poller_mode = ENV.fetch('BOT_POLLER_MODE') do
|
||||
Rails.env.development? if defined?(Rails)
|
||||
end
|
||||
end
|
||||
|
||||
# Hash of bots made with bots_config.
|
||||
|
||||
@@ -6,7 +6,7 @@ module Telegram
|
||||
module Instrumentation
|
||||
class << self
|
||||
def prepended(base)
|
||||
base.config_accessor :logger
|
||||
base.send :config_accessor, :logger
|
||||
base.extend ClassMethods
|
||||
end
|
||||
|
||||
|
||||
@@ -77,11 +77,25 @@ module Telegram
|
||||
|
||||
def reload!
|
||||
return yield unless reload
|
||||
ActionDispatch::Reloader.prepare!
|
||||
if controller.is_a?(Class) && controller.name
|
||||
@controller = Object.const_get(controller.name)
|
||||
reloading_code do
|
||||
if controller.is_a?(Class) && controller.name
|
||||
@controller = Object.const_get(controller.name)
|
||||
end
|
||||
yield
|
||||
end
|
||||
end
|
||||
|
||||
if defined?(Rails) && Rails.application.respond_to?(:reloader)
|
||||
def reloading_code
|
||||
Rails.application.reloader.wrap do
|
||||
yield
|
||||
end
|
||||
end
|
||||
else
|
||||
def reloading_code
|
||||
ActionDispatch::Reloader.prepare!
|
||||
yield.tap { ActionDispatch::Reloader.cleanup! }
|
||||
end
|
||||
yield.tap { ActionDispatch::Reloader.cleanup! }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module Telegram
|
||||
module Bot
|
||||
VERSION = '0.7.1'.freeze
|
||||
VERSION = '0.7.4'.freeze
|
||||
|
||||
def self.gem_version
|
||||
Gem::Version.new VERSION
|
||||
|
||||
@@ -20,8 +20,8 @@ Gem::Specification.new do |spec|
|
||||
|
||||
spec.required_ruby_version = '~> 2.0'
|
||||
|
||||
spec.add_dependency 'activesupport', '~> 4.0'
|
||||
spec.add_dependency 'actionpack', '~> 4.0'
|
||||
spec.add_dependency 'activesupport', '>= 4.0', '< 5.1'
|
||||
spec.add_dependency 'actionpack', '>= 4.0', '< 5.1'
|
||||
spec.add_dependency 'httpclient', '~> 2.7'
|
||||
spec.add_development_dependency 'bundler', '~> 1.11'
|
||||
spec.add_development_dependency 'rake', '~> 10.0'
|
||||
|
||||
Ссылка в новой задаче
Block a user