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.

base_task.py 823 B

12345678910111213141516171819
  1. # -*- coding: utf-8 -*-
  2. class BaseTask(object):
  3. """A base class for bot tasks that edit Wikipedia."""
  4. task_name = None
  5. def __init__(self):
  6. """This is called once immediately after the task class is loaded by
  7. the task manager (in wiki.task_manager.load_class_from_file())."""
  8. pass
  9. def run(self, **kwargs):
  10. """This is called directly by task_manager.start_task() and is the main
  11. way to make a task do stuff. kwargs will be any keyword arguments
  12. passed to start_task(), which are (of course) optional. The same task
  13. instance is preserved between runs, so you can theoretically store data
  14. in self (e.g. start_task('mytask', action='store', data='foo')) and
  15. then use it later (e.g. start_task('mytask', action='save'))."""
  16. pass