Sha256: 5509452c4a7d99018e42811f803c1b94767481659d2bac8da5b3cc56510b9fda

Contents?: true

Size: 726 Bytes

Versions: 1

Compression:

Stored size: 726 Bytes

Contents

# When asked for help, responds with a list of commands supported by
# all loaded plugins
class Robut::Plugin::Help
  include Robut::Plugin

  # Responds with a list of commands supported by all loaded plugins.
  def handle(time, sender_nick, message)
    words = words(message)
    if sent_to_me?(message) && words.first == 'help'
      reply("Supported commands:")
      Robut::Plugin.plugins.each do |plugin|
        plugin_instance = plugin.new(connection, private_sender)
        Array(plugin_instance.usage).each do |command_usage|
          reply(command_usage)
        end
      end
    end
  end

  # Returns a description of how to use this plugin
  def usage
    "#{at_nick} help - displays this message"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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