lib/tasks/telegram-bot.rake in telegram-bot-0.16.1 vs lib/tasks/telegram-bot.rake in telegram-bot-0.16.3
- old
+ new
@@ -1,20 +1,22 @@
+# frozen_string_literal: true
+
namespace :telegram do
namespace :bot do
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)
- if ::Rails.logger.respond_to?(:broadcast_to)
- ::Rails.logger.broadcast_to(console)
+ console = ActiveSupport::Logger.new($stderr)
+ if Rails.logger.respond_to?(:broadcast_to)
+ Rails.logger.broadcast_to(console)
else
Rails.logger.extend ActiveSupport::Logger.broadcast console
end
end
- Telegram::Bot::UpdatesPoller.start(ENV['BOT'].try!(:to_sym) || :default)
+ Telegram::Bot::UpdatesPoller.start(ENV['BOT']&.to_sym || :default)
end
desc 'Set webhook urls for all bots'
task set_webhook: :environment do
Telegram::Bot::Tasks.set_webhook