ZNC AdvancedHighlights

About

AdvancedHighlights is a ZNC module that allows you to define fairly complex rules that will trigger a query sent to you (in essence, a highlight) on certain irc messages.

Installing

  1. Install pygeoip and pyyaml python modules as these are required for AdvancedHighlights to function
  • sudo apt-get install python3-setuptools
  • sudo easy_install3 pygeoip
  • sudo easy_install3 pyyaml
  1. Install AdvancedHighlights
  • Download the latest AdvancedHighlights by running git clone git://github.com/Azelphur/AdvancedHighlights.git
  • Move the files into your ZNC modules directory (usually ~/.znc/modules) by typing mv AdvancedHighlights/ ~/.znc/modules*
  1. Log in to your ZNC web panel and load the AdvancedHighlights module, then create a configuration in the Advanced Highlights section

FAQ

Q: I can't see AdvancedHighlights in my module list!

A: You probably don't have modpython loaded, make sure to do that.

Q: I can't see modpython either!

A: You probably built ZNC without python support, rebuild ZNC using ./configure --enable-python

Q: I get an ImportError even though I've installed the dependencies!

A: You need to restart ZNC after installing new python modules otherwise it won't see them.

Q: I like you and want to send you money

A: You can send money to paypal azelphur@azelphur.com or BTC address 1HCmvBfk8Pg51xXgEoDU2UXKVv6VatMKEC

Matchers

To match messages, you have a number of "matchers", you can use them in any combination to achieve what ever goal you are looking for. Any matcher name preceeded by "!" will match the opposite, for example "geoip" will only match people from the listed countries, while "!geoip" will only match messages NOT from the listed countries.

word

matches a single word or combination of words.

  • match - Word(s) to match

  • case_sensitive - True or False on whether the match should be cAsE sEnSiTiVe

Example this example will match "I like my bacon done crispy" but not "Ilikebacon"

word:
  case_sensitive: false
  match: bacon

text

matches any text in the message, not to be confused with word.

  • match - Word(s) to match

  • case_sensitive - True or False on whether the match should be cAsE sEnSiTiVe

Example this example will match anything with "bacon" in it.

text:
  case_sensitive: false
  match: bacon

channels

matches a list of channel(s)

Example this example will match to #chat and #bacon

channels:
  - "#chat"
  - "#bacon"

geoip

Will do a GeoIP lookup on the hostname of the user and match what country they are in.

Example this example will match only users who GeoIP to Great Britain or the United States.

geoip:
  - GB
  - US

nick

This will match a list of nicknames

Example this example will only match fred and bob.

nick:
  - fred
  - bob

Adding new filters

Adding your own filter is relatively simple.

Add a function to the AdvancedHighlights class that returns true or false, depending on your conditions

For example, lets look at the channels filter

def channels(self, args, data):
  if data['channel'] in args:
    return True
  return False

The args variable contains all the config options for your rule, in this case it's a list of channels. data is a dictionary that contains information about the event, currently it has the following subkeys text - the message nick - the nickname that triggered the event host - the hostname that triggered the event channel - the channel the event was triggered on

You don't need to do anything else but create the function, after that it's all ready to go! the function name is the name of the matcher for the config. Submit pull requests for interesting filters!