Class: SlackRubyBot::App

Inherits:
Object
  • Object
show all
Includes:
Hooks::Hello, Hooks::Message
Defined in:
lib/slack-ruby-bot/app.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Hooks::Message

#message

Methods included from Hooks::Base

#included

Methods included from Hooks::Hello

#hello

Constructor Details

#initializeApp

Returns a new instance of App.



8
9
10
11
12
13
14
15
# File 'lib/slack-ruby-bot/app.rb', line 8

def initialize
  SlackRubyBot.configure do |config|
    config.token = ENV['SLACK_API_TOKEN'] || fail("Missing ENV['SLACK_API_TOKEN'].")
  end
  Slack.configure do |config|
    config.token = SlackRubyBot.config.token
  end
end

Class Method Details

.instanceObject



21
22
23
# File 'lib/slack-ruby-bot/app.rb', line 21

def self.instance
  @instance ||= SlackRubyBot::App.new
end

Instance Method Details

#configObject



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

def config
  SlackRubyBot.config
end

#runObject



25
26
27
28
# File 'lib/slack-ruby-bot/app.rb', line 25

def run
  auth!
  start!
end

#stop!Object



30
31
32
# File 'lib/slack-ruby-bot/app.rb', line 30

def stop!
  client.stop
end