Bladeren bron

watcher_logic -> rules

tags/v0.1^2
Ben Kurtovic 13 jaren geleden
bovenliggende
commit
b7b885beb4
2 gewijzigde bestanden met toevoegingen van 9 en 12 verwijderingen
  1. +1
    -4
      bot/rules.py
  2. +8
    -8
      bot/watcher.py

bot/watcher_logic.py → bot/rules.py Bestand weergeven

@@ -1,13 +1,10 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-


""" """
EarwigBot's IRC Watcher Logic
EarwigBot's IRC Watcher Rules


This file contains (configurable!) rules that EarwigBot's watcher uses after it This file contains (configurable!) rules that EarwigBot's watcher uses after it
recieves an event from IRC. recieves an event from IRC.

This should, ideally, be in config.json somehow, but Python code makes more
sense for this sort of thing... so...
""" """


import re import re

+ 8
- 8
bot/watcher.py Bestand weergeven

@@ -4,15 +4,15 @@
EarwigBot's IRC Watcher Component EarwigBot's IRC Watcher Component


The IRC watcher runs on a wiki recent-changes server and listens for edits. The IRC watcher runs on a wiki recent-changes server and listens for edits.
Users cannot interact with this part of the bot. When an event occurs, run it
through irc/watcher_logic.py's process() function, which can result in either
wiki bot tasks being started (listed in wiki/tasks/) or messages being sent to
channels in the IRC frontend.
Users cannot interact with this part of the bot. When an event occurs, we run
it through rules.py's process() function, which can result in wiki bot tasks
being started (located in tasks/) or messages being sent to channels on the IRC
frontend.
""" """


import config import config
from classes import Connection, RC, BrokenSocketException from classes import Connection, RC, BrokenSocketException
import watcher_logic as logic
import rules


frontend_conn = None frontend_conn = None


@@ -81,10 +81,10 @@ def process_rc(rc):
"""Process a recent change event from IRC (or, an RC object). """Process a recent change event from IRC (or, an RC object).


The actual processing is configurable, so we don't have that hard-coded The actual processing is configurable, so we don't have that hard-coded
here. We simply call watcher_logic's process() function and expect a list
of channels back, which we report the event data to.
here. We simply call rules's process() function and expect a list of
channels back, which we report the event data to.
""" """
chans = watcher_logic.process(rc)
chans = rules.process(rc)
if chans and frontend_conn: if chans and frontend_conn:
pretty = rc.get_pretty() pretty = rc.get_pretty()
for chan in chans: for chan in chans:


Laden…
Annuleren
Opslaan