A Python robot that edits Wikipedia and interacts with people over IRC https://en.wikipedia.org/wiki/User:EarwigBot
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

34 Zeilen
1.2 KiB

  1. # -*- coding: utf-8 -*-
  2. # EarwigBot Configuration File
  3. # This file contains rules for the bot's watcher component.
  4. import re
  5. AFC_CHANS = ["#wikipedia-en-afc"] # report recent AfC changes/give AfC status messages upon join
  6. BOT_CHANS = ["##earwigbot", "#wikipedia-en-afc"] # report edits containing "!earwigbot"
  7. def process(rc):
  8. chans = set() # channels to report this message to
  9. page_name = rc.page.lower()
  10. if "!earwigbot" in rc.msg.lower():
  11. chans.update(BOT_CHANS)
  12. if re.match("wikipedia( talk)?:(wikiproject )?articles for creation", page_name):
  13. chans.update(AFC_CHANS)
  14. elif re.match("wikipedia( talk)?:files for upload", page_name):
  15. chans.update(AFC_CHANS)
  16. elif page_name.startswith("template:afc submission"):
  17. chans.update(AFC_CHANS)
  18. elif rc.flags == "delete" and re.match("deleted \"\[\[wikipedia( talk)?:(wikiproject )?articles for creation", rc.comment.lower()):
  19. chans.update(AFC_CHANS)
  20. elif rc.flags == "protect" and re.match("protected \"\[\[wikipedia( talk)?:(wikiproject )?articles for creation", rc.comment.lower()):
  21. chans.update(AFC_CHANS)
  22. return chans