A Python robot that edits Wikipedia and interacts with people over IRC https://en.wikipedia.org/wiki/User:EarwigBot
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
1.4 KiB

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