Sha256: 5668afa7123131b760348a74c626f8a3568071018bca0fd95d0a7b34734a0762

Contents?: true

Size: 397 Bytes

Versions: 2

Compression:

Stored size: 397 Bytes

Contents

# A plugin that tells robut to repeat whatever he's told.
class Robut::Plugin::Echo < Robut::Plugin::Base

  # Responds with +message+ if the command sent to robut is 'echo'.
  def handle(time, sender_nick, message)
    words = words(message)
    if sent_to_me?(message) && words.first == 'echo'
      phrase = words[1..-1].join(' ')
      reply(phrase) unless phrase.empty?
    end
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
robut-0.2.1 lib/robut/plugin/echo.rb
robut-0.2.0 lib/robut/plugin/echo.rb