Class: SlackRubyBot::App

Inherits:
Server
  • Object
show all
Defined in:
lib/slack-ruby-bot/app.rb

Instance Attribute Summary

Attributes inherited from Server

#aliases, #send_gifs, #token

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Server

#restart!, #run, #start!, #start_async, #stop!

Methods included from Hooks::Message

#message

Methods included from Hooks::Base

#included

Methods included from Hooks::Hello

#hello

Constructor Details

#initialize(options = {}) ⇒ App

Returns a new instance of App.



3
4
5
6
7
8
9
10
11
12
# File 'lib/slack-ruby-bot/app.rb', line 3

def initialize(options = {})
  SlackRubyBot.configure do |config|
    config.token = ENV['SLACK_API_TOKEN'] || fail("Missing ENV['SLACK_API_TOKEN'].")
    config.aliases = ENV['SLACK_RUBY_BOT_ALIASES'].split(' ') if ENV['SLACK_RUBY_BOT_ALIASES']
  end
  Slack.configure do |config|
    config.token = SlackRubyBot.config.token
  end
  super
end

Class Method Details

.instanceObject



18
19
20
# File 'lib/slack-ruby-bot/app.rb', line 18

def self.instance
  @instance ||= new
end

Instance Method Details

#configObject



14
15
16
# File 'lib/slack-ruby-bot/app.rb', line 14

def config
  SlackRubyBot.config
end