Pārlūkot izejas kodu

RC objects are now work correctly for non-enwiki sites

tags/v0.1^2
Ben Kurtovic pirms 12 gadiem
vecāks
revīzija
97e31b8a5d
2 mainītis faili ar 4 papildinājumiem un 3 dzēšanām
  1. +3
    -2
      earwigbot/irc/rc.py
  2. +1
    -1
      earwigbot/irc/watcher.py

+ 3
- 2
earwigbot/irc/rc.py Parādīt failu

@@ -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_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}" 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 self.msg = msg


def parse(self): def parse(self):
@@ -51,7 +52,7 @@ class RC(object):
# We're probably missing the http:// part, because it's a log # We're probably missing the http:// part, because it's a log
# entry, which lacks a URL: # entry, which lacks a URL:
page, flags, user, comment = self.re_log.findall(msg)[0] 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 self.is_edit = False # This is a log entry, not edit




+ 1
- 1
earwigbot/irc/watcher.py Parādīt failu

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


msg = " ".join(line[3:])[1:] 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. rc.parse() # Parse a message into pagenames, usernames, etc.
self._process_rc_event(rc) self._process_rc_event(rc)




Notiek ielāde…
Atcelt
Saglabāt