class FiltersModule

Author

Giuseppe “Oblomov” Bilotta <gmail at giuseppe.bilotta.com>

Public Class Methods

new() click to toggle source
# File lib/rbot/core/filters_ui.rb, line 10
def initialize
  super
  @bot.clear_filters
  @bot.register_filter(:htmlinfo) { |s| Utils.get_html_info(s.to_s, s) }
end

Public Instance Methods

do_list(m, params) click to toggle source
# File lib/rbot/core/filters_ui.rb, line 20
def do_list(m, params)
  g = params[:group]
  ar = @bot.filter_names(g).map { |s| s.to_s }.sort!
  if ar.empty?
    if g
      msg = _("no filters in group %{g}") % {:g => g}
    else
      msg = _("no known filters")
    end
  else
    msg = _("known filters: ") << ar.join(", ")
  end
  m.reply msg
end
do_listgroups(m, params) click to toggle source
# File lib/rbot/core/filters_ui.rb, line 35
def do_listgroups(m, params)
  ar = @bot.filter_groups.map { |s| s.to_s }.sort!
  if ar.empty?
    msg = _("no known filter groups")
  else
    msg = _("known filter groups: ") << ar.join(", ")
  end
  m.reply msg
end
help(plugin, topic="") click to toggle source
# File lib/rbot/core/filters_ui.rb, line 16
def help(plugin, topic="")
  "filters list [<group>] => list filters (in group <group>) | filters search <pat> => list filters matching regexp <pat>"
end