lib/lita/adapters/shell.rb in lita-0.0.1 vs lib/lita/adapters/shell.rb in lita-1.0.0

- old
+ new

@@ -1,21 +1,28 @@ module Lita module Adapters class Shell < Adapter def run + user = User.new(1, name: "Shell User") + source = Source.new(user) puts 'Type "exit" or "quit" to end the session.' + loop do print "#{robot.name} > " - input = gets.chomp.strip + input = $stdin.gets.chomp.strip break if input == "exit" || input == "quit" - source = Source.new("Shell User") message = Message.new(robot, input, source) - robot.receive(message) + Thread.new { robot.receive(message) } end end - def send_messages(target, *strings) - puts *strings + def send_messages(target, strings) + puts + puts strings + end + + def shut_down + puts end end Lita.register_adapter(:shell, Shell) end