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.

vor 12 Jahren
vor 12 Jahren
vor 12 Jahren
vor 12 Jahren
vor 12 Jahren
vor 12 Jahren
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533
  1. EarwigBot
  2. =========
  3. EarwigBot_ is a Python_ robot that edits Wikipedia_ and interacts with people
  4. over IRC_. This file provides a basic overview of how to install and setup the
  5. bot; more detailed information is located in the ``docs/`` directory (available
  6. online at PyPI_).
  7. History
  8. -------
  9. Development began, based on the `Pywikipedia framework`_, in early 2009.
  10. Approval for its fist task, a `copyright violation detector`_, was carried out
  11. in May, and the bot has been running consistently ever since (with the
  12. exception of Jan/Feb 2011). It currently handles `several ongoing tasks`_
  13. ranging from statistics generation to category cleanup, and on-demand tasks
  14. such as WikiProject template tagging. Since it started running, the bot has
  15. made over 50,000 edits.
  16. A project to rewrite it from scratch began in early April 2011, thus moving
  17. away from the Pywikipedia framework and allowing for less overall code, better
  18. integration between bot parts, and easier maintenance.
  19. Installation
  20. ------------
  21. This package contains the core ``earwigbot``, abstracted enough that it should
  22. be usable and customizable by anyone running a bot on a MediaWiki site. Since
  23. it is component-based, the IRC components can be disabled if desired. IRC
  24. commands and bot tasks specific to `my instance of EarwigBot`_ that I don't
  25. feel the average user will need are available from the repository
  26. `earwigbot-plugins`_.
  27. It's recommended to run the bot's unit tests before installing. Run ``python
  28. setup.py test`` from the project's root directory. Note that some
  29. tests require an internet connection, and others may take a while to run.
  30. Coverage is currently rather incomplete.
  31. Latest release (v0.1)
  32. ~~~~~~~~~~~~~~~~~~~~~
  33. EarwigBot is available from the `Python Package Index`_, so you can install the
  34. latest release with ``pip install earwigbot`` (`get pip`_).
  35. You can also install it from source [1]_ directly::
  36. curl -Lo earwigbot.tgz https://github.com/earwig/earwigbot/tarball/v0.1
  37. tar -xf earwigbot.tgz
  38. cd earwig-earwigbot-*
  39. python setup.py install
  40. cd ..
  41. rm -r earwigbot.tgz earwig-earwigbot-*
  42. Development version
  43. ~~~~~~~~~~~~~~~~~~~
  44. You can install the development version of the bot from ``git`` by using
  45. setuptools/distribute's ``develop`` command [1]_, probably on the ``develop``
  46. branch which contains (usually) working code. ``master`` contains the latest
  47. release. EarwigBot uses `git flow`_, so you're free to
  48. browse by tags or by new features (``feature/*`` branches)::
  49. git clone git://github.com/earwig/earwigbot.git earwigbot
  50. cd earwigbot
  51. python setup.py develop
  52. Setup
  53. -----
  54. The bot stores its data in a "working directory", including its config file and
  55. databases. This is also the location where you will place custom IRC commands
  56. and bot tasks, which will be explained later. It doesn't matter where this
  57. directory is, as long as the bot can write to it.
  58. Start the bot with ``earwigbot path/to/working/dir``, or just ``earwigbot`` if
  59. the working directory is the current directory. It will notice that no
  60. ``config.yml`` file exists and take you through the setup process.
  61. There is currently no way to edit the ``config.yml`` file from within the bot
  62. after it has been created, but YAML is a very straightforward format, so you
  63. should be able to make any necessary changes yourself. Check out the
  64. `explanation of YAML`_ on Wikipedia for help.
  65. After setup, the bot will start. This means it will connect to the IRC servers
  66. it has been configured for, schedule bot tasks to run at specific times, and
  67. then wait for instructions (as commands on IRC). For a list of commands, say
  68. "``!help``" (commands are messages prefixed with an exclamation mark).
  69. You can stop the bot at any time with Control+C, same as you stop a normal
  70. Python program, and it will try to exit safely. You can also use the
  71. "``!quit``" command on IRC.
  72. Customizing
  73. -----------
  74. The bot's working directory contains a ``commands`` subdirectory and a
  75. ``tasks`` subdirectory. Custom IRC commands can be placed in the former,
  76. whereas custom wiki bot tasks go into the latter. Developing custom modules is
  77. explained below, and in more detail through the bot's documentation on PyPI_.
  78. Note that custom commands will override built-in commands and tasks with the
  79. same name.
  80. ``Bot`` and ``BotConfig``
  81. ~~~~~~~~~~~~~~~~~~~~~~~~~
  82. `earwigbot.bot.Bot`_ is EarwigBot's main class. You don't have to instantiate
  83. this yourself, but it's good to be familiar with its attributes and methods,
  84. because it is the main way to communicate with other parts of the bot. A
  85. ``Bot`` object is accessible as an attribute of commands and tasks (i.e.,
  86. ``self.bot``).
  87. The most useful attributes are:
  88. - ``bot.config``: an instance of ``BotConfig``, for accessing the bot's
  89. configuration data (see below).
  90. - ``bot.commands``: the bot's ``CommandManager``, which is used internally to
  91. run IRC commands (through ``bot.commands.call()``, which you shouldn't have
  92. to use); you can safely reload all commands with ``bot.commands.load()``.
  93. - ``bot.tasks``: the bot's ``TaskManager``, which can be used to start tasks
  94. with ``bot.tasks.start(task_name, **kwargs)``. ``bot.tasks.load()`` can be
  95. used to safely reload all tasks.
  96. - ``bot.frontend`` / ``bot.watcher``: instances of ``earwigbot.irc.Frontend``
  97. and ``earwigbot.irc.Watcher``, respectively, which represent the bot's
  98. connections to these two servers; you can, for example, send a message to the
  99. frontend with ``bot.frontend.say(chan, msg)`` (more on communicating with IRC
  100. below).
  101. - ``bot.wiki``: interface with `the Wiki Toolset`_ (see below).
  102. - Finally, ``bot.restart()`` (restarts IRC components and reloads config,
  103. commands, and tasks) and ``bot.stop()`` can be used almost anywhere. Both
  104. take an optional "reason" that will be logged and used as the quit message
  105. when disconnecting from IRC.
  106. `earwigbot.config.BotConfig`_ stores configuration information for the bot. Its
  107. docstring explains what each attribute is used for, but essentially each "node"
  108. (one of ``config.components``, ``wiki``, ``irc``, ``commands``, ``tasks``, and
  109. ``metadata``) maps to a section of the bot's ``config.yml`` file. For example,
  110. if ``config.yml`` includes something like::
  111. irc:
  112. frontend:
  113. nick: MyAwesomeBot
  114. channels:
  115. - "##earwigbot"
  116. - "#channel"
  117. - "#other-channel"
  118. ...then ``config.irc["frontend"]["nick"]`` will be ``"MyAwesomeBot"`` and
  119. ``config.irc["frontend"]["channels"]`` will be ``["##earwigbot", "#channel",
  120. "#other-channel"]``.
  121. Custom IRC commands
  122. ~~~~~~~~~~~~~~~~~~~
  123. Custom commands are subclasses of `earwigbot.commands.BaseCommand`_ that
  124. override ``BaseCommand``'s ``process()`` (and optionally ``check()`` or
  125. ``setup()``) methods.
  126. ``BaseCommand``'s docstrings should explain what each attribute and method is
  127. for and what they should be overridden with, but these are the basics:
  128. - Class attribute ``name`` is the name of the command. This must be specified.
  129. - Class attribute ``commands`` is a list of names that will trigger this
  130. command. It defaults to the command's ``name``, but you can override it with
  131. multiple names to serve as aliases. This is handled by the default
  132. ``check()`` implementation (see below), so if ``check()`` is overridden, this
  133. is ignored by everything except the help_ command (so ``!help alias`` will
  134. trigger help for the actual command).
  135. - Class attribute ``hooks`` is a list of the "IRC events" that this command
  136. might respond to. It defaults to ``["msg"]``, but options include
  137. ``"msg_private"`` (for private messages only), ``"msg_public"`` (for channel
  138. messages only), and ``"join"`` (for when a user joins a channel). See the
  139. afc_status_ plugin for a command that responds to other hook types.
  140. - Method ``setup()`` is called *once* with no arguments immediately after the
  141. command is first loaded. Does nothing by default; treat it like an
  142. ``__init__()`` if you want (``__init__()`` does things by default and a
  143. dedicated setup method is often easier than overriding ``__init__()`` and
  144. using ``super``).
  145. - Method ``check()`` is passed a ``Data`` [2]_ object, and should return
  146. ``True`` if you want to respond to this message, or ``False`` otherwise. The
  147. default behavior is to return ``True`` only if ``data.is_command`` is
  148. ``True`` and ``data.command`` ``==`` ``self.name`` (or ``data.command`` is in
  149. ``self.commands`` if that list is overriden; see above), which is suitable
  150. for most cases. A possible reason for overriding is if you want to do
  151. something in response to events from a specific channel only. Note that by
  152. returning ``True``, you prevent any other commands from responding to this
  153. message.
  154. - Method ``process()`` is passed the same ``Data`` object as ``check()``, but
  155. only if ``check()`` returned ``True``. This is where the bulk of your command
  156. goes. To respond to IRC messages, there are a number of methods of
  157. ``BaseCommand`` at your disposal. See the the test_ command for a simple
  158. example, or look in BaseCommand's ``__init__`` method for the full list.
  159. The most common ones are ``self.say(chan_or_user, msg)``,
  160. ``self.reply(data, msg)`` (convenience function; sends a reply to the
  161. issuer of the command in the channel it was received),
  162. ``self.action(chan_or_user, msg)``, ``self.notice(chan_or_user, msg)``,
  163. ``self.join(chan)``, and ``self.part(chan)``.
  164. Commands have access to ``config.commands[command_name]`` for config
  165. information, which is a node in ``config.yml`` like every other attribute of
  166. ``bot.config``. This can be used to store, for example, API keys or SQL
  167. connection info, so that these can be easily changed without modifying the
  168. command itself.
  169. It's important to name the command class ``Command`` within the file, or else
  170. the bot might not recognize it as a command. The name of the file doesn't
  171. really matter and need not match the command's name, but this is recommended
  172. for readability.
  173. The bot has a wide selection of built-in commands and plugins to act as sample
  174. code and/or to give ideas. Start with test_, and then check out chanops_ and
  175. afc_status_ for some more complicated scripts.
  176. Custom bot tasks
  177. ~~~~~~~~~~~~~~~~
  178. Custom tasks are subclasses of `earwigbot.tasks.BaseTask`_ that override
  179. ``BaseTask``'s ``run()`` (and optionally ``setup()``) methods.
  180. ``BaseTask``'s docstrings should explain what each attribute and method is for
  181. and what they should be overridden with, but these are the basics:
  182. - Class attribute ``name`` is the name of the task. This must be specified.
  183. - Class attribute ``number`` can be used to store an optional "task number",
  184. possibly for use in edit summaries (to be generated with ``make_summary()``).
  185. For example, EarwigBot's ``config.wiki["summary"]`` is
  186. ``"([[WP:BOT|Bot]]; [[User:EarwigBot#Task $1|Task $1]]): $2"``, which the
  187. task class's ``make_summary(comment)`` method will take and replace ``$1``
  188. with the task number and ``$2`` with the details of the edit.
  189. Additionally, ``shutoff_enabled()`` (which checks whether the bot has been
  190. told to stop on-wiki by checking the content of a particular page) can check
  191. a different page for each task using similar variables. EarwigBot's
  192. ``config.wiki["shutoff"]["page"]`` is ``"User:$1/Shutoff/Task $2"``; ``$1``
  193. is substituted with the bot's username, and ``$2`` is substituted with the
  194. task number, so, e.g., task #14 checks the page
  195. ``[[User:EarwigBot/Shutoff/Task 14]].`` If the page's content does *not*
  196. match ``config.wiki["shutoff"]["disabled"]`` (``"run"`` by default), then
  197. shutoff is considered to be *enabled* and ``shutoff_enabled()`` will return
  198. ``True``, indicating the task should not run. If you don't intend to use
  199. either of these methods, feel free to leave this attribute blank.
  200. - Method ``setup()`` is called *once* with no arguments immediately after the
  201. task is first loaded. Does nothing by default; treat it like an
  202. ``__init__()`` if you want (``__init__()`` does things by default and a
  203. dedicated setup method is often easier than overriding ``__init__()`` and
  204. using ``super``).
  205. - Method ``run()`` is called with any number of keyword arguments every time
  206. the task is executed (by ``bot.tasks.start(task_name, **kwargs)``, usually).
  207. This is where the bulk of the task's code goes. For interfacing with
  208. MediaWiki sites, read up on `the Wiki Toolset`_ below.
  209. Tasks have access to ``config.tasks[task_name]`` for config information, which
  210. is a node in ``config.yml`` like every other attribute of ``bot.config``. This
  211. can be used to store, for example, edit summaries or templates to append to
  212. user talk pages, so that these can be easily changed without modifying the task
  213. itself.
  214. It's important to name the task class ``Task`` within the file, or else the bot
  215. might not recognize it as a task. The name of the file doesn't really matter
  216. and need not match the task's name, but this is recommended for readability.
  217. See the built-in wikiproject_tagger_ task for a relatively straightforward
  218. task, or the afc_statistics_ plugin for a more complicated one.
  219. The Wiki Toolset
  220. ----------------
  221. EarwigBot's answer to the `Pywikipedia framework`_ is the Wiki Toolset
  222. (``earwigbot.wiki``), which you will mainly access through ``bot.wiki``.
  223. ``bot.wiki`` provides three methods for the management of Sites -
  224. ``get_site()``, ``add_site()``, and ``remove_site()``. Sites are objects that
  225. simply represent a MediaWiki site. A single instance of EarwigBot (i.e. a
  226. single *working directory*) is expected to relate to a single site or group of
  227. sites using the same login info (like all WMF wikis with CentralAuth).
  228. Load your default site (the one that you picked during setup) with
  229. ``site = bot.wiki.get_site()``.
  230. Dealing with other sites
  231. ~~~~~~~~~~~~~~~~~~~~~~~~
  232. *Skip this section if you're only working with one site.*
  233. If a site is *already known to the bot* (meaning that it is stored in the
  234. ``sites.db`` file, which includes just your default wiki at first), you can
  235. load a site with ``site = bot.wiki.get_site(name)``, where ``name`` might be
  236. ``"enwiki"`` or ``"frwiktionary"`` (you can also do
  237. ``site = bot.wiki.get_site(project="wikipedia", lang="en")``). Recall that not
  238. giving any arguments to ``get_site()`` will return the default site.
  239. ``add_site()`` is used to add new sites to the sites database. It may be called
  240. with similar arguments as ``get_site()``, but the difference is important.
  241. ``get_site()`` only needs enough information to identify the site in its
  242. database, which is usually just its name; the database stores all other
  243. necessary connection info. With ``add_site()``, you need to provide enough
  244. connection info so the toolset can successfully access the site's API/SQL
  245. databases and store that information for later. That might not be much; for
  246. WMF wikis, you can usually use code like this::
  247. project, lang = "wikipedia", "es"
  248. try:
  249. site = bot.wiki.get_site(project=project, lang=lang)
  250. except earwigbot.SiteNotFoundError:
  251. # Load site info from http://es.wikipedia.org/w/api.php:
  252. site = bot.wiki.add_site(project=project, lang=lang)
  253. This works because EarwigBot assumes that the URL for the site is
  254. ``"//{lang}.{project}.org"`` and the API is at ``/w/api.php``; this might
  255. change if you're dealing with non-WMF wikis, where the code might look
  256. something more like::
  257. project, lang = "mywiki", "it"
  258. try:
  259. site = bot.wiki.get_site(project=project, lang=lang)
  260. except earwigbot.SiteNotFoundError:
  261. # Load site info from http://mysite.net/mywiki/it/s/api.php:
  262. base_url = "http://mysite.net/" + project + "/" + lang
  263. db_name = lang + project + "_p"
  264. sql = {host: "sql.mysite.net", db: db_name}
  265. site = bot.wiki.add_site(base_url=base_url, script_path="/s", sql=sql)
  266. ``remove_site()`` does the opposite of ``add_site()``: give it a site's name
  267. or a project/lang pair like ``get_site()`` takes, and it'll remove that site
  268. from the sites database.
  269. Sites
  270. ~~~~~
  271. ``Site`` objects provide the following attributes:
  272. - ``name``: the site's name (or "wikiid"), like ``"enwiki"``
  273. - ``project``: the site's project name, like ``"wikipedia"``
  274. - ``lang``: the site's language code, like ``"en"``
  275. - ``domain``: the site's web domain, like ``"en.wikipedia.org"``
  276. and the following methods:
  277. - ``api_query(**kwargs)``: does an API query with the given keyword arguments
  278. as params
  279. - ``sql_query(query, params=(), ...)``: does an SQL query and yields its
  280. results (as a generator)
  281. - ``get_replag()``: returns the estimated database replication lag (if we have
  282. the site's SQL connection info)
  283. - ``namespace_id_to_name(id, all=False)``: given a namespace ID, returns the
  284. primary associated namespace name (or a list of all names when ``all`` is
  285. ``True``)
  286. - ``namespace_name_to_id(name)``: given a namespace name, returns the
  287. associated namespace ID
  288. - ``get_page(title, follow_redirects=False)``: returns a ``Page`` object for
  289. the given title (or a ``Category`` object if the page's namespace is
  290. "``Category:``")
  291. - ``get_category(catname, follow_redirects=False)``: returns a ``Category``
  292. object for the given title (sans namespace)
  293. - ``get_user(username)``: returns a ``User`` object for the given username
  294. Pages and categories
  295. ~~~~~~~~~~~~~~~~~~~~
  296. Create ``Page`` objects with ``site.get_page(title)``,
  297. ``page.toggle_talk()``, ``user.get_userpage()``, or ``user.get_talkpage()``.
  298. They provide the following attributes:
  299. - ``title``: the page's title, or pagename
  300. - ``exists``: whether the page exists
  301. - ``pageid``: an integer ID representing the page
  302. - ``url``: the page's URL
  303. - ``namespace``: the page's namespace as an integer
  304. - ``protection``: the page's current protection status
  305. - ``is_talkpage``: ``True`` if the page is a talkpage, else ``False``
  306. - ``is_redirect``: ``True`` if the page is a redirect, else ``False``
  307. and the following methods:
  308. - ``reload()``: forcibly reload the page's attributes (emphasis on *reload* -
  309. this is only necessary if there is reason to believe they have changed)
  310. - ``toggle_talk(...)``: returns a content page's talk page, or vice versa
  311. - ``get()``: returns page content
  312. - ``get_redirect_target()``: if the page is a redirect, returns its destination
  313. - ``get_creator()``: returns a ``User`` object representing the first user to
  314. edit the page
  315. - ``edit(text, summary, minor=False, bot=True, force=False)``: replaces the
  316. page's content with ``text`` or creates a new page
  317. - ``add_section(text, title, minor=False, bot=True, force=False)``: adds a new
  318. section named ``title`` at the bottom of the page
  319. - ``copyvio_check(...)``: checks the page for copyright violations
  320. - ``copyvio_compare(url, ...)``: checks the page like ``copyvio_check()``, but
  321. against a specific URL
  322. Additionally, ``Category`` objects (created with ``site.get_category(name)`` or
  323. ``site.get_page(title)`` where ``title`` is in the ``Category:`` namespace)
  324. provide the following additional method:
  325. - ``get_members(use_sql=False, limit=None)``: returns a list of page titles in
  326. the category (limit is ``50`` by default if using the API)
  327. Users
  328. ~~~~~
  329. Create ``User`` objects with ``site.get_user(name)`` or
  330. ``page.get_creator()``. They provide the following attributes:
  331. - ``name``: the user's username
  332. - ``exists``: ``True`` if the user exists, or ``False`` if they do not
  333. - ``userid``: an integer ID representing the user
  334. - ``blockinfo``: information about any current blocks on the user (``False`` if
  335. no block, or a dict of ``{"by": blocking_user, "reason": block_reason,
  336. "expiry": block_expire_time}``)
  337. - ``groups``: a list of the user's groups
  338. - ``rights``: a list of the user's rights
  339. - ``editcount``: the number of edits made by the user
  340. - ``registration``: the time the user registered as a ``time.struct_time``
  341. - ``emailable``: ``True`` if you can email the user, ``False`` if you cannot
  342. - ``gender``: the user's gender (``"male"``, ``"female"``, or ``"unknown"``)
  343. and the following methods:
  344. - ``reload()``: forcibly reload the user's attributes (emphasis on *reload* -
  345. this is only necessary if there is reason to believe they have changed)
  346. - ``get_userpage()``: returns a ``Page`` object representing the user's
  347. userpage
  348. - ``get_talkpage()``: returns a ``Page`` object representing the user's
  349. talkpage
  350. Additional features
  351. ~~~~~~~~~~~~~~~~~~~
  352. Not all aspects of the toolset are covered here. Explore `its code and
  353. docstrings`_ to learn how to use it in a more hands-on fashion. For reference,
  354. ``bot.wiki`` is an instance of ``earwigbot.wiki.SitesDB`` tied to the
  355. ``sites.db`` file in the bot's working directory.
  356. Tips
  357. ----
  358. - Logging_ is a fantastic way to monitor the bot's progress as it runs. It has
  359. a slew of built-in loggers, and enabling log retention (so logs are saved to
  360. ``logs/`` in the working directory) is highly recommended. In the normal
  361. setup, there are three log files, each of which "rotate" at a specific time
  362. (``filename.log`` becomes ``filename.log.2012-04-10``, for example). The
  363. ``debug.log`` file rotates every hour, and maintains six hours of logs of
  364. every level (``DEBUG`` and up). ``bot.log`` rotates every day at midnight,
  365. and maintains seven days of non-debug logs (``INFO`` and up). Finally,
  366. ``error.log`` rotates every Sunday night, and maintains four weeks of logs
  367. indicating unexpected events (``WARNING`` and up).
  368. To use logging in your commands or tasks (recommended), ``BaseCommand`` and
  369. ``BaseTask`` provide ``logger`` attributes configured for the specific
  370. command or task. If you're working with other classes, ``bot.logger`` is the
  371. root logger (``logging.getLogger("earwigbot")`` by default), so you can use
  372. ``getChild`` to make your logger. For example, task loggers are essentially
  373. ``bot.logger.getChild("tasks").getChild(task.name)``.
  374. - A very useful IRC command is "``!reload``", which reloads all commands and
  375. tasks without restarting the bot. [3]_ Combined with using the `!git plugin`_
  376. for pulling repositories from IRC, this can provide a seamless command/task
  377. development workflow if the bot runs on an external server and you set up
  378. its working directory as a git repo.
  379. - You can run a task by itself instead of the entire bot with ``earwigbot
  380. path/to/working/dir --task task_name``.
  381. - Questions, comments, or suggestions about the documentation? `Let me know`_
  382. so I can improve it for other people.
  383. Footnotes
  384. ---------
  385. .. [1] ``python setup.py install``/``develop`` may require root, or use the
  386. ``--user`` switch to install for the current user only.
  387. .. [2] ``Data`` objects are instances of ``earwigbot.irc.Data`` that contain
  388. information about a single message sent on IRC. Their useful attributes
  389. are ``chan`` (channel the message was sent from, equal to ``nick`` if
  390. it's a private message), ``nick`` (nickname of the sender), ``ident``
  391. (ident_ of the sender), ``host`` (hostname of the sender), ``msg`` (text
  392. of the sent message), ``is_command`` (boolean telling whether or not
  393. this message is a bot command, i.e., whether it is prefixed by ``!``),
  394. ``command`` (if the message is a command, this is the name of the
  395. command used), and ``args`` (if the message is a command, this is a list
  396. of the command arguments - for example, if issuing "``!part ##earwig
  397. Goodbye guys``", ``args`` will equal ``["##earwig", "Goodbye",
  398. "guys"]``). Note that not all ``Data`` objects will have all of these
  399. attributes: ``Data`` objects generated by private messages will, but
  400. ones generated by joins will only have ``chan``, ``nick``, ``ident``,
  401. and ``host``.
  402. .. [3] In reality, all this does is call ``bot.commands.load()`` and
  403. ``bot.tasks.load()``!
  404. .. _EarwigBot: http://en.wikipedia.org/wiki/User:EarwigBot
  405. .. _Python: http://python.org/
  406. .. _Wikipedia: http://en.wikipedia.org/
  407. .. _IRC: http://en.wikipedia.org/wiki/Internet_Relay_Chat
  408. .. _PyPI: http://packages.python.org/earwigbot
  409. .. _Pywikipedia framework: http://pywikipediabot.sourceforge.net/
  410. .. _copyright violation detector: http://en.wikipedia.org/wiki/Wikipedia:Bots/Requests_for_approval/EarwigBot_1
  411. .. _several ongoing tasks: http://en.wikipedia.org/wiki/User:EarwigBot#Tasks
  412. .. _my instance of EarwigBot: http://en.wikipedia.org/wiki/User:EarwigBot
  413. .. _earwigbot-plugins: https://github.com/earwig/earwigbot-plugins
  414. .. _Python Package Index: http://pypi.python.org
  415. .. _get pip: http://pypi.python.org/pypi/pip
  416. .. _git flow: http://nvie.com/posts/a-successful-git-branching-model/
  417. .. _explanation of YAML: http://en.wikipedia.org/wiki/YAML
  418. .. _earwigbot.bot.Bot: https://github.com/earwig/earwigbot/blob/develop/earwigbot/bot.py
  419. .. _earwigbot.config.BotConfig: https://github.com/earwig/earwigbot/blob/develop/earwigbot/config.py
  420. .. _earwigbot.commands.BaseCommand: https://github.com/earwig/earwigbot/blob/develop/earwigbot/commands/__init__.py
  421. .. _help: https://github.com/earwig/earwigbot/blob/develop/earwigbot/commands/help.py
  422. .. _afc_status: https://github.com/earwig/earwigbot-plugins/blob/develop/commands/afc_status.py
  423. .. _chanops: https://github.com/earwig/earwigbot/blob/develop/earwigbot/commands/chanops.py
  424. .. _test: https://github.com/earwig/earwigbot/blob/develop/earwigbot/commands/test.py
  425. .. _earwigbot.tasks.BaseTask: https://github.com/earwig/earwigbot/blob/develop/earwigbot/tasks/__init__.py
  426. .. _wikiproject_tagger: https://github.com/earwig/earwigbot/blob/develop/earwigbot/tasks/wikiproject_tagger.py
  427. .. _afc_statistics: https://github.com/earwig/earwigbot-plugins/blob/develop/tasks/afc_statistics.py
  428. .. _its code and docstrings: https://github.com/earwig/earwigbot/tree/develop/earwigbot/wiki
  429. .. _logging: http://docs.python.org/library/logging.html
  430. .. _Let me know: ben.kurtovic@verizon.net
  431. .. _!git plugin: https://github.com/earwig/earwigbot-plugins/blob/develop/commands/git.py
  432. .. _ident: http://en.wikipedia.org/wiki/Ident