class DogePlugin < Plugin
  def initialize
    super
    @thesaurus = {}
    IO.readlines(File.dirname(__FILE__) + '/thesaurus').each do |line|
      terms = line.split(',')
      @thesaurus[terms.shift.downcase] = terms
    end
  end

  def help(plugin, topic=nil)
    'such help, so doge, wow!'
  end

  def doge(m, params)
    term = params[:term].join(' ')
    synonyms = @thesaurus[term.downcase]
    synonym = synonyms ? synonyms.sample : term
    m.reply "#{' '*rand(20)}such #{term}, so #{synonym}, wow!"
  end
end

plugin = DogePlugin.new
plugin.map('doge *term')