Class: StallmanBot::Bot

Inherits:
Object
  • Object
show all
Defined in:
lib/stallman_bot/bot.rb

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Bot

Returns a new instance of Bot.



8
9
10
11
12
13
14
# File 'lib/stallman_bot/bot.rb', line 8

def initialize(config)
  @config = config
  @token = @config[:token]
  @debug = @config[:debug]
  Locale.load_i18n(@config[:locale])
  @listener = Listener.new
end

Instance Method Details

#runObject



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/stallman_bot/bot.rb', line 16

def run
  puts "Stallman_bot running... (DEBUG: #{@debug})"
  if @debug
    local_handler
  elsif @token.empty?
    puts "Invalid/empty token: #{@token}"
    exit
  else
    bot_handler
  end
end