{ "info": { "author": "Brian \u00d3", "author_email": "blacksam@gibberfish.org", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# python-matrixbot\n\nA Python module meant to act as a base class for a [Matrix](https://matrix.org) bot.\n\n## Compatibility\n\nPython 3.6+\n\n## Installation\n\n pip install python-matrixbot\n\n## Usage\n\nThe MatrixBot class will connect to the Matrix server, start a listener on each joined\nroom, and listen for room invites from other users. It also includes helper methods you\ncan use to extend the functionality. It is built on the\n[Matrix Python SDK](https://matrix-org.github.io/matrix-python-sdk/) which can be\ndirectly accessed via `MatrixBot.client`\n\n from matrixbot import MatrixBot\n\n # create a new bot\n bot = MatrixBot(\n host=\"example.com\",\n display_name=\"Example Bot\",\n token=access_token,\n user_id=\"@bot:example.com\"\n )\n # run forever\n bot.start()\n\n### Get a list of joined rooms:\n\n room_ids = bot.rooms.keys()\n room_objects = bot.rooms.values()\n\n### Leave abandoned 1-on-1 rooms\n\n for room in bot.rooms.values():\n bot.leave_if_empty(room)\n\n### Cache results from external API calls\n\nTo prevent abuse of commands that rely on external API calls, MatrixBot includes a\nvery basic caching mechanism. Wrap all API calls in `MatrixBot.fetch()` to return\ncached results and automatically refresh stale data.\n\n def get_url(url):\n return response.get(url)\n\n result = bot.fetch(\n \"cache_key\", lambda: get_url(\"https://example.com\"), timeout=900\n )\n\nBy default the module uses an in-memory cache which is lost between restarts. To create\na persistent cache provide the constructor with the path to a sqlite database:\n\n bot = MatrixBot(\n ...\n cache_db=\"/path/to/sqlite_database\"\n )\n\n### Sub-classing\nCreate a subclass to extend and override default features\n\n class MyBot(MatrixBot):\n # override `process_message()` to filter/parse/react to room events:\n def process_message(self, room, event):\n # say hello when a user joins the room\n if event[\"type\"] == \"m.room.member\":\n if event[\"content\"][\"membership\"] == \"join\":\n self.say(room, \"Hello!\", mention=event[\"sender\"])\n\n # override `accept_invite()` to disable auto-join:\n def accept_invite(self, room_id):\n pass\n\n bot = MyBot(...)\n\n## License\n\nMIT\n\n## Maintainer\n\nBrian \u00d3 \n\nContributions welcome.\n\n## About Gibberfish\n\nGibberfish, Inc is a volunteer nonprofit that develops free tools to promote online\nprivacy for activists and regular people alike. If you like this module and decide to\nuse it in your project, please consider donating $1 to help keep us going. Thanks!\n\nhttps://gibberfish.org/donate/\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://gitlab.com/gibberfish/python-matrixbot", "keywords": "bot botscript chat matrix", "license": "", "maintainer": "", "maintainer_email": "", "name": "python-matrixbot", "package_url": "https://pypi.org/project/python-matrixbot/", "platform": "", "project_url": "https://pypi.org/project/python-matrixbot/", "project_urls": { "Donations": "https://gibberfish.org/donate/", "Homepage": "https://gitlab.com/gibberfish/python-matrixbot", "Issues": "https://gitlab.com/gibberfish/python-matrixbot/issues", "Source": "https://gitlab.com/gibberfish/python-matrixbot" }, "release_url": "https://pypi.org/project/python-matrixbot/0.0.7/", "requires_dist": [ "markdown", "matrix-client" ], "requires_python": "~=3.6", "summary": "A basic bot for Matrix", "version": "0.0.7" }, "last_serial": 5523632, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "9314d8515cc20ca196ab62fa303bc9ee", "sha256": "c0a283ab5b2311ed34743850e72e5524c466e56069f54c36d516d2d4b97a9d8c" }, "downloads": -1, "filename": "python_matrixbot-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "9314d8515cc20ca196ab62fa303bc9ee", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7670, "upload_time": "2019-07-01T00:45:07", "url": "https://files.pythonhosted.org/packages/57/ff/1c2a2b20817a40b8b1de8605a210055be709ce695894c4c21a763e303e57/python_matrixbot-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a21aa656ad18159b4c48a872d414ac5a", "sha256": "adf632b69d92bd5a65a1ecb1d71738ac70a1601b12ecbc2aaf3c0194750a6274" }, "downloads": -1, "filename": "python-matrixbot-0.0.1.tar.gz", "has_sig": false, "md5_digest": "a21aa656ad18159b4c48a872d414ac5a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5965, "upload_time": "2019-07-01T00:45:10", "url": "https://files.pythonhosted.org/packages/19/3c/ee608a559d05ac75c19b2204cca44bad8fc8b5c79704c5b8da7070cdca4b/python-matrixbot-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "87d29fc51a5c486058497e0bbb89b6e0", "sha256": "b8466067e4b90a775db13db7f0d312b5674748f80cb36e669b6b2df57754ca77" }, "downloads": -1, "filename": "python_matrixbot-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "87d29fc51a5c486058497e0bbb89b6e0", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7854, "upload_time": "2019-07-01T18:19:58", "url": "https://files.pythonhosted.org/packages/d9/98/7d684c5b6427b5b8565852d4f7a502b0cec020452bd16e5a4a4de2c40464/python_matrixbot-0.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b4b41eeb0826a1a6f53d644ae17c57a8", "sha256": "ed460f5ac9dde5de36f927413c65381f4cf4dfe8b11afb828e10e72f63135c4f" }, "downloads": -1, "filename": "python-matrixbot-0.0.2.tar.gz", "has_sig": false, "md5_digest": "b4b41eeb0826a1a6f53d644ae17c57a8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6171, "upload_time": "2019-07-01T18:20:00", "url": "https://files.pythonhosted.org/packages/ca/67/2e37745e5d4c1f570d66f00ba4335259058794bf02143ec77d584868efd8/python-matrixbot-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "ad2fef3af1759db3738c0daa81667024", "sha256": "7efa45f1f7f13c3ec286372066d5e8b148eeccef8a007445b7789953928cf197" }, "downloads": -1, "filename": "python_matrixbot-0.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "ad2fef3af1759db3738c0daa81667024", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7903, "upload_time": "2019-07-01T19:00:06", "url": "https://files.pythonhosted.org/packages/88/af/27a0e23696a94e83c7812e863d07014011868be68a9952f4f0fa90366e2c/python_matrixbot-0.0.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9dbde16976e045b86a826b38f7c9a9a2", "sha256": "1834adabc8cde50deb2e30952072198c513756a12ad36193c5003cf9ce33d4d4" }, "downloads": -1, "filename": "python-matrixbot-0.0.3.tar.gz", "has_sig": false, "md5_digest": "9dbde16976e045b86a826b38f7c9a9a2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6227, "upload_time": "2019-07-01T19:00:07", "url": "https://files.pythonhosted.org/packages/04/f3/0e9be616c90c9d622bfaba73f384e6aaa3437f7a2c9cebf5fd4600bf38c1/python-matrixbot-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "3e3655601513670a8cc0002ce22f176d", "sha256": "306f18c1e7f30b78dfe0865dc0616e7e94806152f3bbe7a71c9162a385f6d0d5" }, "downloads": -1, "filename": "python_matrixbot-0.0.4-py3-none-any.whl", "has_sig": false, "md5_digest": "3e3655601513670a8cc0002ce22f176d", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": "~=3.6", "size": 7982, "upload_time": "2019-07-01T19:37:55", "url": "https://files.pythonhosted.org/packages/c7/d2/cf2a067c6c1dbf9e321ea054fb798b0143dccba1e939bbab8d3047297653/python_matrixbot-0.0.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d0c6f02034d421657f45c981fa7dd229", "sha256": "007afad4632b4c4c6a714d03cb774e267587421ffa31485dbb5268a77c754a2a" }, "downloads": -1, "filename": "python-matrixbot-0.0.4.tar.gz", "has_sig": false, "md5_digest": "d0c6f02034d421657f45c981fa7dd229", "packagetype": "sdist", "python_version": "source", "requires_python": "~=3.6", "size": 6386, "upload_time": "2019-07-01T19:37:56", "url": "https://files.pythonhosted.org/packages/09/45/dc82093e956eff6f5be1e68a4f9eb2af48bdfdf7e78280dcfd97951b5580/python-matrixbot-0.0.4.tar.gz" } ], "0.0.5": [ { "comment_text": "", "digests": { "md5": "c3eada000b81cd25ffaeddd59a2a1182", "sha256": "8551f289039cd35f6a223284094df2847776de2c924479e8563635b04bd03836" }, "downloads": -1, "filename": "python_matrixbot-0.0.5-py3-none-any.whl", "has_sig": false, "md5_digest": "c3eada000b81cd25ffaeddd59a2a1182", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": "~=3.6", "size": 7981, "upload_time": "2019-07-01T19:59:05", "url": "https://files.pythonhosted.org/packages/0d/49/c06fa49d06601038678db06480a192271390fe14ddec185cc9b773404b9d/python_matrixbot-0.0.5-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3cc491a1a227bb2e34741c13c2fdddda", "sha256": "9a9a73862d25918398c5431bf0ce660ce661cc82a5b7768fa4c57b8a6bfbe90a" }, "downloads": -1, "filename": "python-matrixbot-0.0.5.tar.gz", "has_sig": false, "md5_digest": "3cc491a1a227bb2e34741c13c2fdddda", "packagetype": "sdist", "python_version": "source", "requires_python": "~=3.6", "size": 6410, "upload_time": "2019-07-01T19:59:06", "url": "https://files.pythonhosted.org/packages/b8/f3/3c7b3897c62101ce1ae62d62f6595dab89fe72d6814a6281b35a1b795114/python-matrixbot-0.0.5.tar.gz" } ], "0.0.6": [ { "comment_text": "", "digests": { "md5": "df73d2ad064ac0b2708ba4cb26edba91", "sha256": "ffb08aa637d077dbde6da87a1e31d0d036a94c7859d1f740290e7d2415e8eea8" }, "downloads": -1, "filename": "python_matrixbot-0.0.6-py3-none-any.whl", "has_sig": false, "md5_digest": "df73d2ad064ac0b2708ba4cb26edba91", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": "~=3.6", "size": 8036, "upload_time": "2019-07-10T16:39:44", "url": "https://files.pythonhosted.org/packages/f1/f9/1edd996d2d63314438bdedc8d6c904d402174758390d8fef2255f23564ca/python_matrixbot-0.0.6-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2703a1fc5ee6f6a01399d5d07675413f", "sha256": "667d7256e5da9d82676e5c4552218ee4f9c7b8b6fecb8bef91b25a4d21ee0791" }, "downloads": -1, "filename": "python-matrixbot-0.0.6.tar.gz", "has_sig": false, "md5_digest": "2703a1fc5ee6f6a01399d5d07675413f", "packagetype": "sdist", "python_version": "source", "requires_python": "~=3.6", "size": 6479, "upload_time": "2019-07-10T16:39:45", "url": "https://files.pythonhosted.org/packages/7c/85/50d48403bf03ca0c137b8e34063e1a4a796651f7bd8ae8b82d7ea60305ce/python-matrixbot-0.0.6.tar.gz" } ], "0.0.7": [ { "comment_text": "", "digests": { "md5": "20e6dd4d83e99f1f1dbb5939d40a039e", "sha256": "27a6ee03548e07a56d06b2842e8407fcdf7f1841c3d6bd64a26e46516f43d524" }, "downloads": -1, "filename": "python_matrixbot-0.0.7-py3-none-any.whl", "has_sig": false, "md5_digest": "20e6dd4d83e99f1f1dbb5939d40a039e", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": "~=3.6", "size": 11159, "upload_time": "2019-07-12T14:58:48", "url": "https://files.pythonhosted.org/packages/79/25/2b46ca246d79523d6c26e368ce9f4be811788841da7578c56e634209acea/python_matrixbot-0.0.7-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "bf87d77eeef4a9b8ca8d7259484e09fd", "sha256": "9412981b14ff3ab7ffbb1bfc1691758113ab8d71f731b3093d8808c286b69c71" }, "downloads": -1, "filename": "python-matrixbot-0.0.7.tar.gz", "has_sig": false, "md5_digest": "bf87d77eeef4a9b8ca8d7259484e09fd", "packagetype": "sdist", "python_version": "source", "requires_python": "~=3.6", "size": 8745, "upload_time": "2019-07-12T14:58:49", "url": "https://files.pythonhosted.org/packages/5f/6f/9487ea2214593bdbec5b12143aa21d90553f0763da7e0efb170297e2c0b4/python-matrixbot-0.0.7.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "20e6dd4d83e99f1f1dbb5939d40a039e", "sha256": "27a6ee03548e07a56d06b2842e8407fcdf7f1841c3d6bd64a26e46516f43d524" }, "downloads": -1, "filename": "python_matrixbot-0.0.7-py3-none-any.whl", "has_sig": false, "md5_digest": "20e6dd4d83e99f1f1dbb5939d40a039e", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": "~=3.6", "size": 11159, "upload_time": "2019-07-12T14:58:48", "url": "https://files.pythonhosted.org/packages/79/25/2b46ca246d79523d6c26e368ce9f4be811788841da7578c56e634209acea/python_matrixbot-0.0.7-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "bf87d77eeef4a9b8ca8d7259484e09fd", "sha256": "9412981b14ff3ab7ffbb1bfc1691758113ab8d71f731b3093d8808c286b69c71" }, "downloads": -1, "filename": "python-matrixbot-0.0.7.tar.gz", "has_sig": false, "md5_digest": "bf87d77eeef4a9b8ca8d7259484e09fd", "packagetype": "sdist", "python_version": "source", "requires_python": "~=3.6", "size": 8745, "upload_time": "2019-07-12T14:58:49", "url": "https://files.pythonhosted.org/packages/5f/6f/9487ea2214593bdbec5b12143aa21d90553f0763da7e0efb170297e2c0b4/python-matrixbot-0.0.7.tar.gz" } ] }