Sha256: 24553da36875d178cce7020066c804d41d732d81a548d3384831cdf1ce3bbea8

Contents?: true

Size: 1.06 KB

Versions: 8

Compression:

Stored size: 1.06 KB

Contents

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)
        Rails.logger.extend ActiveSupport::Logger.broadcast console
      end
      Telegram::Bot::UpdatesPoller.start(ENV['BOT'].try!(:to_sym) || :default)
    end

    desc 'Set webhook urls for all bots'
    task set_webhook: :environment do
      Telegram::Bot::Tasks.set_webhook
    end

    desc 'Delete webhooks for all or specific BOT'
    task :delete_webhook do
      Telegram::Bot::Tasks.delete_webhook
    end

    desc 'Perform logOut command for all or specific BOT'
    task :log_out do
      Telegram::Bot::Tasks.log_out
    end

    desc 'Perform `close` command for all or specific BOT'
    task :close do
      Telegram::Bot::Tasks.close
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
telegram-bot-0.16.0 lib/tasks/telegram-bot.rake
telegram-bot-0.15.7 lib/tasks/telegram-bot.rake
telegram-bot-0.15.6 lib/tasks/telegram-bot.rake
telegram-bot-0.15.4 lib/tasks/telegram-bot.rake
telegram-bot-0.15.3 lib/tasks/telegram-bot.rake
telegram-bot-0.15.2 lib/tasks/telegram-bot.rake
telegram-bot-0.15.1 lib/tasks/telegram-bot.rake
telegram-bot-0.15.0 lib/tasks/telegram-bot.rake