{ "info": { "author": "Daniel Lindsley", "author_email": "daniel@toastdriven.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Utilities" ], "description": "Toastbot\n========\n\nA clean, extensible IRC bot using Python, irckit, gevent & requests.\n\n**Author:** Daniel Lindsley
\n**License:** BSD
\n**Version:** 0.4.1\n\n\nRequirements\n------------\n\n* Python 2.6+\n* gevent\n* irckit\n* requests\n\n\nUsage\n-----\n\nCreate your own ``bot.py`` file & drop in:\n\n import toastbot\n\n bot = toastbot.ToastBot('myircbot', '#myircchannel')\n bot.setup()\n\nThen run it with ``python bot.py``.\n\n\nConfiguration\n-------------\n\nThe ``Toastbot`` object requires ``nick`` & ``channel`` arguments & can take a\nvariety of non-required options.\n\n### Required arguments\n\n* ``nick`` - The nickname of the bot, as a string.\n* ``channel`` - The channel the bot should connect to, as a string.\n\n### Options\n\n* ``server`` - The server the bot should connect to (default: ``irc.freenode.net``).\n* ``username`` -The username the bot should identify as (default: ``nick``);\n* ``realname`` - The human readable name the bot should provide (default: 'ToastBot').\n* ``debug`` - Controls if the IRC connection should dump debug messages (default: ``false``).\n* ``log_dir`` - Controls what directory the logs should go in (default: ``$INSTALL_DIRECTORY/logs``).\n* ``variants`` - Used to override ways to address the bot. Should be strings (default: ``[self.nick+': ', self.nick+', ', self.nick+'- ', self.nick+' - ']``).\n\n\nAvailable \"handlers\"\n--------------------\n\nHandlers are how the bot can perform actions based on an incoming message. They\nare simple methods hanging off the bot object. The built-in list consists of:\n\n* ``help`` - Provides a description of what I respond to.\n* ``dance`` - Get down and funky.\n* ``woodies`` - Best quote on the internet..\n* ``wiki`` - Search Wikipedia for a topic.\n* ``metar`` - Fetch a NOAA METAR by station code.\n* ``twitter`` - Search Twitter for a topic.\n* ``fatpita`` - Get a random fatpita image. For the lulz.\n* ``corgibomb`` - CORGI BOMB\n\n\nExtending the bot\n-----------------\n\nAdding on further handlers is relatively simple. At its most basic, it's simply\nadding on a new method decorated with ``toastbot.handler``. For example, logging\nhow many times a user has said something in the channel might look like:\n\n import toastbot\n\n class MyBot(toastbot.ToastBot):\n talkers = {}\n\n def __init__(self, *args, **kwargs):\n super(MyBot, self).__init__(*args, **kwargs)\n self.enabled_commands += [\n self.how_chatty,\n ]\n\n def how_chatty(self, nick, text):\n \"\"\"Logs how often a user has said something.\"\"\"\n if nick in self.talkers:\n self.talkers[nick] += 1\n else:\n self.talkers[nick] = 1\n\n print self.talkers.items()\n\n\n bot = MyBot('myircbot', '#myircchannel')\n bot.setup()\n\nNote that this command does not require addressing the bot at all. If you want\na command that the bot responds to, you might write something like:\n\n import toastbot\n\n class StoolPigeon(toastbot.ToastBot):\n # Assume the previous example, but adding...\n def __init__(self, *args, **kwargs):\n super(StoolPigeon, self).__init__(*args, **kwargs)\n self.enabled_commands += [\n self.stool_pigeon,\n ]\n\n def stool_pigeon(self, nick, text):\n \"\"\"Rat out the talkers.\"\"\"\n text = self.is_direct_command('stool_pigeon', text)\n\n if not text:\n raise NotHandled()\n\n return str(self.talkers)\n\n bot = StoolPigeon('myircbot', '#myircchannel')\n bot.setup()\n\nThis checks to see if the bot is being directly addressed then returns a\nstring-ified version of the ``talker`` stats. The included handlers demonstrate\neven more complex behavior, such as how to do network fetches or asynchronous\nresponses.\n\nTo disable handlers:\n\n import toastbot\n\n class MyBot(toastbot.ToastBot):\n talkers = {}\n\n def __init__(self, *args, **kwargs):\n super(MyBot, self).__init__(*args, **kwargs)\n self.enabled_commands = [func for func in self.enabled_commands if func.__name__ != 'twitter']\n\n bot = MyBot('myircbot', '#myircchannel')\n bot.setup()", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/toastdriven/toastbot", "keywords": null, "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "toastbot", "package_url": "https://pypi.org/project/toastbot/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/toastbot/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/toastdriven/toastbot" }, "release_url": "https://pypi.org/project/toastbot/0.4.1/", "requires_dist": null, "requires_python": null, "summary": "A clean, extensible IRC bot using irckit.", "version": "0.4.1" }, "last_serial": 635644, "releases": { "0.4.0": [ { "comment_text": "", "digests": { "md5": "8c5622ee94bc78358c2668e76cd87830", "sha256": "d82f81b66d4b7136a2d8b89f29e677bc0a486c0295b78bbcb28125437b8ab9eb" }, "downloads": -1, "filename": "toastbot-0.4.0.tar.gz", "has_sig": false, "md5_digest": "8c5622ee94bc78358c2668e76cd87830", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5109, "upload_time": "2011-11-29T03:25:00", "url": "https://files.pythonhosted.org/packages/a9/c5/1a78d912ed735bfa654fa3ee0a6df2b58d79abe0d867669026e591345c1b/toastbot-0.4.0.tar.gz" } ], "0.4.1": [ { "comment_text": "", "digests": { "md5": "a79ae03665beaef6765c7b0646634e8e", "sha256": "7ff2c6f976260e68029078a4589183b5f74ab517ffca3611a298038b8a90d907" }, "downloads": -1, "filename": "toastbot-0.4.1.tar.gz", "has_sig": false, "md5_digest": "a79ae03665beaef6765c7b0646634e8e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6280, "upload_time": "2012-02-27T17:19:08", "url": "https://files.pythonhosted.org/packages/ff/e6/13e7c803afb36d85b23efb7a9b3af4c9b70df65b5a7c7d8493c1b6eae454/toastbot-0.4.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "a79ae03665beaef6765c7b0646634e8e", "sha256": "7ff2c6f976260e68029078a4589183b5f74ab517ffca3611a298038b8a90d907" }, "downloads": -1, "filename": "toastbot-0.4.1.tar.gz", "has_sig": false, "md5_digest": "a79ae03665beaef6765c7b0646634e8e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6280, "upload_time": "2012-02-27T17:19:08", "url": "https://files.pythonhosted.org/packages/ff/e6/13e7c803afb36d85b23efb7a9b3af4c9b70df65b5a7c7d8493c1b6eae454/toastbot-0.4.1.tar.gz" } ] }