summaryrefslogtreecommitdiff
path: root/lib/rbot/core/wordlist_ui.rb
blob: 8042089a754fc89184b52da77bf370090d39734a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#-- vim:sw=2:et
#++
#
# :title: wordlist management from IRC
#
# Author:: Giuseppe "Oblomov" Bilotta <giuseppe.bilotta@gmail.com>

class WordlistModule < CoreBotModule
  def help(plugin, topic="")
    _("wordlist list [<pattern>] => list wordlists (matching <pattern>)")
  end

  def do_list(m, p)
    found = Wordlist.list(@bot, p)
    if found.empty?
      m.reply _("no wordlists found in %{path}") % {
        path: @bot.path('wordlists')
      }
    else
      m.reply _("Wordlists: %{found}") % {
        found: found.sort.join(', ')
      }
    end
  end
end

plugin = WordlistModule.new

plugin.map "wordlist list [:pattern]", :action => :do_list