Przeglądaj źródła

RC objects are now work correctly for non-enwiki sites

tags/v0.1^2
Ben Kurtovic 12 lat temu
rodzic
commit
97e31b8a5d
2 zmienionych plików z 4 dodań i 3 usunięć
  1. +3
    -2
      earwigbot/irc/rc.py
  2. +1
    -1
      earwigbot/irc/watcher.py

+ 3
- 2
earwigbot/irc/rc.py Wyświetl plik

@@ -33,7 +33,8 @@ class RC(object):
pretty_edit = "\x02New {0}\x0F: \x0314[[\x0307{1}\x0314]]\x0306 * \x0303{2}\x0306 * \x0302{3}\x0306 * \x0310{4}"
pretty_log = "\x02New {0}\x0F: \x0303{1}\x0306 * \x0302{2}\x0306 * \x0310{3}"

def __init__(self, msg):
def __init__(self, chan, msg):
self.chan = chan
self.msg = msg

def parse(self):
@@ -51,7 +52,7 @@ class RC(object):
# We're probably missing the http:// part, because it's a log
# entry, which lacks a URL:
page, flags, user, comment = self.re_log.findall(msg)[0]
url = "".join(("http://en.wikipedia.org/wiki/", page))
url = "http://{0}.org/wiki/{1}".format(self.chan, page)

self.is_edit = False # This is a log entry, not edit



+ 1
- 1
earwigbot/irc/watcher.py Wyświetl plik

@@ -61,7 +61,7 @@ class Watcher(IRCConnection):
return

msg = " ".join(line[3:])[1:]
rc = RC(msg) # New RC object to store this event's data
rc = RC(chan, msg) # New RC object to store this event's data
rc.parse() # Parse a message into pagenames, usernames, etc.
self._process_rc_event(rc)



Ładowanie…
Anuluj
Zapisz