{ "info": { "author": "Tommy Yu", "author_email": "y@metatoaster.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Console", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Internet", "Topic :: Utilities" ], "description": "Introduction\n============\n\nmtj.jibber is a package that can be used to streamline the process of\nproviding automagical useless bantering onto your friendly neighbourhood\nrooms (multi-user chat or MUCS) on all the Jabber (XMPP) servers.\n\nIt's jibber jabber time.\n\n.. image:: https://travis-ci.org/metatoaster/mtj.jibber.svg?branch=0.4.x\n :target: https://travis-ci.org/metatoaster/mtj.jibber\n.. image:: https://coveralls.io/repos/metatoaster/mtj.jibber/badge.svg?branch=0.4.x\n :target: https://coveralls.io/r/metatoaster/mtj.jibber?branch=0.4.x\n\nInstallation\n============\n\nThis is a piece of cake. Get a virtualenv running, and do this:\n\n.. code:: sh\n\n $ pip install mtj.jibber\n\nThis installs the latest stable release version of this package from\nthe Python Package Index (pypi). If you wish to do so, you should\nfollow the `documentation on that index page`_.\n\n.. _documentation on that index page: https://pypi.python.org/pypi/mtj.jibber\n\nAlternatively, if you want to hack and develop on this, please feel free\nto make a fork and clone that or clone directly from this fork.\nNaturally I will assume you got a virtualenv setup, too:\n\n.. code:: sh\n\n $ git clone https://github.com/metatoaster/mtj.jibber.git\n $ cd mtj.jibber\n $ python setup.py develop\n\nOf course, in that case you should follow the documentation as listed\nin the README.rst found at the root of the source repository.\n\nQuick Start Tutorial\n====================\n\nThe original reason for making this is to allow much modularity and very\neasy usage. To demonstrate this, get this package installed and get the\ndefault configuration files generated like so:\n\n.. code:: sh\n\n $ jibber --gen-config server > server.config.json\n $ jibber --gen-config client > client.config.json\n\nNow you can start the bot like so:\n\n.. code:: sh\n\n $ jibber server.config.json client.config.json debug\n Starting interactive shell. `bot` is bound to the MucBot object.\n Try calling bot.connect() to connect to the server specified in config file.\n Note: process will NOT terminate if bot.is_alive() is False!\n Alternatively call bot_test() to test here locally.\n >>>\n\nSo the interactive shell should have started like it did above if this\npackage was installed correctly. Now you can issue the command:\n\n.. code:: python\n\n >>> bot_test()\n Test client ready; call client('Hello bot') to interact.\n >>>\n\nA new function is provided for you to interact with the bot, you can\njust follow the prompt:\n\n.. code:: python\n\n >>> client('Hello bot')\n 2013-11-01 00:00:51,316 INFO mtj.jibber.testing hi Tester\n >>>\n\nThe test client doesn't have any connection to any servers, so all the\ninteractions will just end up being shown in the log at the INFO level.\nThis can be useful for your final integration testing.\n\nOf course, you want the bot to do more than this, let's look at the\nclient config file.\n\nClient Config\n-------------\n\nThe packages object contain the list of \"packages\" that will be\ninstantiated for the bot to use. The keys follow:\n\npackage\n The full path to the class (or any callables that return an\n instance of one).\nkwargs\n The keyword arguments that will be passed into that call.\ncommands\n A 2-tuple (well, list, this is JSON after all) of regex string,\n method. The method is a callable attribute will be provided by\n the object returned by the calling ``package(**kwargs)``. The\n regex can contain some string format keywords, most notably\n ``nickname`` which is the nickname assigned to the bot.\n Commands only get executed to the maximum commands limit, and\n the bot will not try to match something it says with the ones\n here.\ncommentators\n Exactly like commands, except the bot will try to comment on\n things it says up to a limit. Default is sane, I am not going\n to teach you how to override that because hilarious infinite\n loops can happen\nlisteners\n All messages passed to the bot will be listened, but no output\n will be sent.\ntimers\n A list of objects that will be used to instantiate repeated\n commands at a delay. This is somewhat advanced and not\n covered here. The test cases might explain how this works.\n\nThe commands_max_match can be defined to match up to that amount of\ncommands, i.e. the commands will not further cascade down once that\namount is reached. This is useful if you have a situation where a\nsignificant amount of triggers overlap.\n\nNow, you might want to extend the bot to do more. Let's try something\nadding something else to the list of packages (remember your JSON comma\nplacements!):\n\n.. code:: json\n\n {\n \"package\": \"mtj.jibber.bot.PickOne\",\n \"kwargs\": {\"items\": [\n \"red!\", \"orange!\", \"yellow!\", \"green!\", \"blue!\", \"violet!\"]},\n \"commands\": [\n [\"^rainbow (color|colour)!$\", \"play\"]\n ]\n }\n\nThe PickOne class has a play method that picks one of the items with an\nequal chance for all. In this case a command that matches either\n`rainbow color!` or `rainbow colour!` and respond with one of the six\nitems specified. Demo run:\n\n.. code:: python\n\n >>> client('rainbow color!')\n 2013-11-01 00:01:31,965 INFO mtj.jibber.testing violet!\n >>> client('rainbow colour!')\n 2013-11-01 00:01:33,981 INFO mtj.jibber.testing orange!\n\nThere is another one that is similar:\n\n.. code:: json\n\n {\n \"package\": \"mtj.jibber.bot.ChanceGame\",\n \"kwargs\": {\"chance_table\": [\n [0.125, \"%(mucnick)s: BOOM\"], [1, \"%(mucnick)s: click\"]\n ]},\n \"commands\": [\n [\"^%(nickname)s: rr$\", \"play\"]\n ]\n }\n\nThis one is similar to PickOne, except with the allowance of a chance\nwhich is specified in the first element of the 2-tuple. The roll is a\nrandom real number between 0 and 1 inclusive, and thus the matching is\ndone by cascading downwards on that list for a match. Match is done by\nchecking whether the number is less than the chance number. If match,\nthe corresponding result is returned. Demo run:\n\n.. code:: python\n\n >>> client('bot: rr')\n 2013-11-01 00:02:11,647 INFO mtj.jibber.testing Tester: click\n >>> client('bot: rr')\n 2013-11-01 00:02:12,714 INFO mtj.jibber.testing Tester: click\n >>> client('bot: rr')\n 2013-11-01 00:02:12,822 INFO mtj.jibber.testing Tester: click\n >>> client('bot: rr')\n 2013-11-01 00:02:13,006 INFO mtj.jibber.testing Tester: BOOM\n\nAlso note how it is possible to specify string format keywords here.\nThe most useful one would be mucnick, which correspond to the user\nwho sent the line. These are based on the msg stanzas used by sleekxmpp\nso for all details check the relevant documentation (or clever\nbreakpoint placements).\n\nFor completeness, if you had followed the above instructions your\nconfiguration should look similar to the output generated by this\ncommand:\n\n.. code:: sh\n\n $ jibber --gen-config client_example\n\nOh yeah, you can naturally develop your own modules that do things you\nwant your bot to do. Feel free to use the classes in mtj.jibber.bot as\nyour starting point, and as a further example on how to build a package\nwith your custom commands, please take a look at `mtj.jibberext`_.\n\n.. _mtj.jibberext: https://github.com/metatoaster/mtj.jibberext\n\nServer Config\n-------------\n\nThe server configuration should be simple. It is done this way to split\nout the connection settings from the actual bot settings you may wish to\npass onto your friends. The keys as follows:\n\njid\n The jid that is used to connect to the server.\npassword\n Password associated with the jid\nhost\n The host used to connect to the server. Optional as this can\n be derived from jid, but quite often the actual host is often\n different so this usually needs to be specified.\nport\n Defaults to 5222.\n\nRemaining keys are passed into the connect method for a sleekxmpp client\ninstance. Refer to documentations over there if you are curious on what\nthey are.\n\nDoing it live\n-------------\n\nFill out the correct information (the jid/password/host and the rooms\nyou wish your bot to join) and then you can call ``bot.connect()``!\nAlternatively you can replace ``debug`` with ``fg`` to have it connect\nright away and ditch the interactive shell.\n\nBonus\n-----\n\nIf you find yourself constantly restarting the bot completely because a\nsingle line of code or setting was changed and also finding this process\ntiresome, there is a helper method in the debug shell that will reload\nthe client configuration file and all modules with the associated timers\nand triggers with just one function call:\n\n.. code:: python\n\n >>> bot_reinit()\n Successfully reinitialized bot configuration and modules.\n >>>\n\nDo note: this function is potentially unsafe. Syntax errors in the\nconfiguration or the modules that got added after the bot has started\nwill be raised as exceptions and loading is aborted, leaving the bot\nin a fresh but partially instantiated state. This may or may not cause\nproblems specific to the code/modules you have loaded with the bot.\n\nChangelog\n=========\n\n0.4 - 2015-09-12\n----------------\n\n- Fully require the ``bot`` argument for all methods.\n- Support hooking up handlers to lower level events, making it possible\n to hook that up via the config file to available module/class paths.\n This is implemented in the ``presence`` module.\n- For the mean time ``Presence`` is the new base ``Handler`` for the\n lower level events.\n- First such handler is the automatic rejoin when bot is no longer in\n a channel, implemented in the ``Muc`` class.\n- Another one is greeter, implemented in the ``MucGreeter`` class.\n- The ``Command`` class is now a subclass of ``Handler``; that is now\n the class that will be checked. In the future this requirement may\n be dropped once validation of argument signature for the provided\n callables can be done.\n- A ``LastActivity`` feature; can be used as a ``!seen`` trigger to\n get back a rough idea on when the user was last seen. This intends to\n be a demo implementation.\n- Test client class now supports scheduling properly; clear method now\n works as intended.\n- Other minor cleanup and updated tests.\n\n0.3 - 2014-10-08\n----------------\n\n- ``MucChatBot.send_message`` now much more resistant to malformed\n messages generated by package method, and now allow overriding of both\n ``mbody`` and ``mhtml`` arguments which will cascade down to the real\n ``send_message`` method, if bot authors want complete output control.\n- Consistently handle lists that may be generated by package_methods in\n the same way as a single text or dict.\n- No longer will assign a reference to ``bot`` for every instances of\n ``Command`` class.\n\n0.2 - 2014-02-27\n----------------\n\n- Private chat message handling for private message commands.\n- Core configuration file generation from the jibber shell command.\n- Helper method for dynamic module reloading within debug mode.\n\n\n0.1 - 2013-11-14\n----------------\n\n- Core functions implemented, including connect to XMPP server as a muc\n client, and to provide trigger handlers and dynamic module/object\n loaders so those triggers can make something happen.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/metatoaster/mtj.jibber/", "keywords": "", "license": "mit", "maintainer": null, "maintainer_email": null, "name": "mtj.jibber", "package_url": "https://pypi.org/project/mtj.jibber/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/mtj.jibber/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/metatoaster/mtj.jibber/" }, "release_url": "https://pypi.org/project/mtj.jibber/0.4/", "requires_dist": null, "requires_python": null, "summary": "A very easy to use, simple to extend jabber bot framework.", "version": "0.4" }, "last_serial": 1719641, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "e517a40421404659f8636797d9895f27", "sha256": "e24f10ddc6a0a8815bdeb39e68eb036e83bdd4f6724df9528cd6ac992e675701" }, "downloads": -1, "filename": "mtj.jibber-0.1.tar.gz", "has_sig": false, "md5_digest": "e517a40421404659f8636797d9895f27", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13924, "upload_time": "2013-11-14T10:29:57", "url": "https://files.pythonhosted.org/packages/ff/5a/72e246f95ab687f8696284004b427af3e651e812de353d3025b1c2ab9d15/mtj.jibber-0.1.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "b131a41dffdf2b86e5f8aa20ff802493", "sha256": "6a2f3c4cf32affd083ce729fa86ccb10ddcee34777c1280bbd741ae972f028b4" }, "downloads": -1, "filename": "mtj.jibber-0.2.tar.gz", "has_sig": false, "md5_digest": "b131a41dffdf2b86e5f8aa20ff802493", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16357, "upload_time": "2014-02-26T12:11:17", "url": "https://files.pythonhosted.org/packages/87/97/6db037129fb591a4f0ba54d644e046612e6d99fe0692e127bffa7d1bea44/mtj.jibber-0.2.tar.gz" } ], "0.3": [ { "comment_text": "", "digests": { "md5": "71254fb6b40fcb56ce7c15e9b4c6b73d", "sha256": "360014cbeb7a6ed66d4e805c5380b9a1c1cf0eac172c4717733b09353e9219be" }, "downloads": -1, "filename": "mtj.jibber-0.3.tar.gz", "has_sig": false, "md5_digest": "71254fb6b40fcb56ce7c15e9b4c6b73d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17956, "upload_time": "2014-10-08T10:20:34", "url": "https://files.pythonhosted.org/packages/85/8a/f485630ef26000447c8cbd8a6eeb6589a54afbe93f5cf90dc853993cdf8d/mtj.jibber-0.3.tar.gz" } ], "0.4": [ { "comment_text": "", "digests": { "md5": "2c8b27ef20d63b0c710bf358ad01c294", "sha256": "e38ebf03cb65ddf0bf1f5cab5e47bb77a393a42672fadfb3bce1d6ebbd5f2a24" }, "downloads": -1, "filename": "mtj.jibber-0.4.tar.gz", "has_sig": false, "md5_digest": "2c8b27ef20d63b0c710bf358ad01c294", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 25038, "upload_time": "2015-09-12T03:38:52", "url": "https://files.pythonhosted.org/packages/fe/1c/74cff137fd7e5280e360298a488220c17a3075461060e3c2b0bbf8e206ce/mtj.jibber-0.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "2c8b27ef20d63b0c710bf358ad01c294", "sha256": "e38ebf03cb65ddf0bf1f5cab5e47bb77a393a42672fadfb3bce1d6ebbd5f2a24" }, "downloads": -1, "filename": "mtj.jibber-0.4.tar.gz", "has_sig": false, "md5_digest": "2c8b27ef20d63b0c710bf358ad01c294", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 25038, "upload_time": "2015-09-12T03:38:52", "url": "https://files.pythonhosted.org/packages/fe/1c/74cff137fd7e5280e360298a488220c17a3075461060e3c2b0bbf8e206ce/mtj.jibber-0.4.tar.gz" } ] }