Class: Lemmibot::CommandInterface

Inherits:
Object
  • Object
show all
Defined in:
lib/lemmibot/command_interface.rb

Overview

An interface for issuing commands to a Lemmibot via CLI/STDIN

Instance Method Summary collapse

Constructor Details

#initializeCommandInterface

Returns a new instance of CommandInterface.



4
5
6
# File 'lib/lemmibot/command_interface.rb', line 4

def initialize
  @bot = Lemmibot::Bot.new
end

Instance Method Details

#startObject



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/lemmibot/command_interface.rb', line 8

def start
  puts 'Lemmibot is awaiting your commands'
  loop do
    command = gets
    return unless command
    begin
      process_command(command.chomp)
    rescue
      # Malformed and failed commands should be ignored
    end
  end
end