瀏覽代碼

Improve parsing rules for usernames in signatures.

tags/v0.1^2
Ben Kurtovic 12 年之前
父節點
當前提交
db59f2ba48
共有 1 個文件被更改,包括 4 次插入3 次删除
  1. +4
    -3
      earwigbot/tasks/drn_clerkbot.py

+ 4
- 3
earwigbot/tasks/drn_clerkbot.py 查看文件

@@ -141,7 +141,7 @@ class DRNClerkBot(Task):
for line in text.splitlines():
user = re.search("\# \{\{User\|(.*?)\}\}", line)
if user:
additions.add((user.group(1),))
additions.add((user.group(1).replace("_", " ").strip(),))

removals = set()
query1 = "SELECT volunteer_username FROM volunteers"
@@ -355,7 +355,8 @@ class DRNClerkBot(Task):
matches = re.findall(regex, text, re.U)
signatures = []
for userlink, stamp in matches:
username = userlink.split("/", 1)[0].replace("_", " ")
username = userlink.split("/", 1)[0].replace("_", " ").strip()
stamp = stamp.strip()
timestamp = datetime.strptime(stamp, "%H:%M, %d %B %Y (UTC)")
signatures.append((username, timestamp))
return signatures
@@ -380,7 +381,7 @@ class DRNClerkBot(Task):
for line in text.group(1).splitlines():
user = re.search("[:*#]{,5} \{\{User\|(.*?)\}\}", line)
if user:
party = user.group(1).strip()
party = user.group(1).replace("_", " ").strip()
notice = _Notice("User talk:" + party, template, too_late)
notices.append(notice)



Loading…
取消
儲存