Sha256: 8398e19491dd81e9cc92e442dd4eb92e80f5a30cdea0c0dff3cd19d9599aa6c5

Contents?: true

Size: 1.21 KB

Versions: 2

Compression:

Stored size: 1.21 KB

Contents

# frozen_string_literal: true

SlackRubyBotServer.configure do |config|
  config.oauth_scope ||= ['bot']
end

SlackRubyBotServer::Config.service_class.instance.on :starting do |team, _error, options|
  SlackRubyBotServer::Config.service_class.instance.logger.info "Starting real-time team #{team}."
  options = { team: team }
  server = SlackRubyBotServer::RealTime::Config.server_class.new(options)
  SlackRubyBotServer::RealTime::Server.start_server! team, server
end

SlackRubyBotServer::Config.service_class.instance.on :restarting do |team, _error, options|
  SlackRubyBotServer::Config.service_class.instance.logger.info "Restarting real-time team #{team}."
  SlackRubyBotServer::RealTime::Server.start_server! team, server, options[:wait]
end

SlackRubyBotServer::Config.service_class.instance.on :stopped do |team, _error, _options|
  SlackRubyBotServer::Config.service_class.instance.logger.info "Stopping real-time team #{team}."
  begin
    team.server&.stop!
  ensure
    team.server = nil
  end
end

SlackRubyBotServer::Config.service_class.instance.on :deactivated do |team, _error, _options|
  SlackRubyBotServer::Config.service_class.instance.logger.info "De-activating real-time team #{team}."
  team.server = nil
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
slack-ruby-bot-server-rtm-0.1.1 lib/slack-ruby-bot-server-rtm/lifecycle.rb
slack-ruby-bot-server-rtm-0.1.0 lib/slack-ruby-bot-server-rtm/lifecycle.rb