Sha256: 4b7df27fcdf7e79078af666085e44a89fd83e223d5910eb40788187921d96353

Contents?: true

Size: 539 Bytes

Versions: 1

Compression:

Stored size: 539 Bytes

Contents

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

  # 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

  # Returns a description of how to use this plugin
  def usage
    "#{at_nick} echo <message> - replies to the channel with <message>"
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
robut-0.3.0 lib/robut/plugin/echo.rb