Filter

class lazbot.filter.Filter(bot, match_txt='', handler=None, channels=None, regex=False)[source]

Logic wrapper for message events

Filter provides a number of helpers to make message filtering, matching, and parsing easier.

classmethod compile_regex(base_str)[source]

compile filter regex into regex matcher

Converts the provided string into a RegexObject and a Parser. This will convert the string into a normal RegexObject. It will first attempt to convert flask-like capture group helpers into Regex capture groups. It will also add translation helpers to the returned Parser object to provide some post processing of the special captures.

Provided captures include:

  • int - looks for numeric values and will convert into a number
  • username - looks for the Slack form of username identifiers and attempts to lookup the User object
  • [username] - like username but looks for a list of them
  • channel - looks for the Slack form of channel identifiers and attempts to lookup the Channel object
  • [channel] - like channel but looks for a list of them
disable()[source]

Disable message matching

Will disable the Filter from matching any messages

enable()[source]

Enable message matching

Will enable the Filter to attempt to match messages

https://secure.travis-ci.org/jdost/lazbot.png?branch=master

Navigation