{ "info": { "author": "Chris K. W.", "author_email": "chriskw.xyz@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python :: 3.5", "Topic :: Communications :: Chat", "Topic :: Games/Entertainment :: Turn Based Strategy", "Topic :: Internet", "Topic :: Utilities" ], "description": "# Intro\nA client for [Pokemon Showdown!](https://pokemonshowdown.com/) for Python 3.4 and 3.5. This was written to make it easier to write bots, interact with users, moderate chat rooms, and collect data.\n\n# Setup\nInstall the package with ``pip3 install --user showdownpy``. This will also install the package's ``websockets`` and ``aiohttp`` dependencies if you do not already have them.\n\n# Example\nExamples have been provided in the ``./examples directory``. Make sure to create your own versions of the ``login.txt`` and ``owner.txt`` files in ``./examples/data/`` directory. Templates for those files have been provided.\n\nThe client on its own doesn't do very much, and is instead intended to be extended and modified. This can be done through various \"hook\" coroutines left in the base class. The following program uses the ``on_private_message`` hook to echo back the content of any PMs it receives.\n\n```python3\n\"\"\"\nAn example client that echoes back any message that is \nprivate messaged to it\n\"\"\"\nimport showdown\n\nwith open('./examples/data/login.txt', 'rt') as f:\n username, password = f.read().strip().splitlines()\n\nclass EchoClient(showdown.Client):\n async def on_private_message(self, pm):\n if pm.recipient == self:\n await pm.reply(pm.content)\n\nEchoClient(name=username, password=password).start()\n```\n\nOther hooks include ``on_connect``, ``on_login``, ``on_room_init``, ``on_room_deinit``, ``on_query_response`` and ``on_chat_message``.\n\nThese hooks are by no means all inclusive (Showdown has somewhere upwards of 40 different types of messages it uses to interact with clients in its protocol), and so a catch-all hook `on_receive` is also present. Each hook is given its own task on the event loop, so you don't have to worry about any tasks blocking each other.\n\nThe bot can also be used for collecting data on battles. The following bot anonymously joins ongoing matches in the format 'OU' and saves replays of them when a user finishes.\n\n```python3\n\"\"\"\nAn example client that joins all OU battles\nand saves replays.\n\"\"\"\nimport showdown\n\nwith open('./examples/data/login.txt', 'rt') as f:\n username, password = f.read().strip().splitlines()\n\nclass ReplayClient(showdown.Client):\n async def on_query_response(self, response_type, data):\n if response_type == 'roomlist':\n for battle_id in set(data['rooms']) - set(self.rooms):\n await self.join(battle_id)\n\n async def on_receive(self, room_id, inp_type, params):\n if inp_type == 'win':\n with open('./data/' + room_id, 'wt') as f:\n f.write('\\n'.join(self.rooms[room_id].logs))\n @showdown.Client.on_interval(interval=3)\n async def check_ou(self): \n await self.query_battles(tier='gen7ou', lifespan=3)\n\nReplayClient(name=username, password=password).start(autologin=False)\n```\n\nIt is recommended that you save local copies of these matches rather than upload them, as to not overwhelm Showdown's replay server.\n\n# Contributions\nThis package is still a work in progress, and any contributions would be great! I'm currently prioritizing documentation over new features, but if you have an idea for something let me know. Feel free to share anything you make with the client and if its succint enough I may add it to the pool of examples.\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://github.com/ckw017/showdown.py", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "showdownpy", "package_url": "https://pypi.org/project/showdownpy/", "platform": "", "project_url": "https://pypi.org/project/showdownpy/", "project_urls": { "Homepage": "https://github.com/ckw017/showdown.py" }, "release_url": "https://pypi.org/project/showdownpy/0.1.2/", "requires_dist": [ "websockets", "aiohttp" ], "requires_python": "", "summary": "An extendable client for interacting with Pokemon Showdown", "version": "0.1.2" }, "last_serial": 4706923, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "da62a30ba07f74fc923e0fdb0b44178c", "sha256": "4d0bcd158a5ebfe98e24d289a63b91e798a2e9fa73fb22574b98fe8bd7a55d6a" }, "downloads": -1, "filename": "showdownpy-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "da62a30ba07f74fc923e0fdb0b44178c", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 22295, "upload_time": "2019-01-14T06:36:11", "url": "https://files.pythonhosted.org/packages/8d/ef/995c98d813ce06bfcccc13b19c83e084413ebd1c95c0e5365b260dfceecd/showdownpy-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0a0cb956966c9a97a71bbfb83b42bd67", "sha256": "928b49734ba95338e35030f69431a78c32a2fd577a07717d87f0c60e475ce5fe" }, "downloads": -1, "filename": "showdownpy-0.1.0.tar.gz", "has_sig": false, "md5_digest": "0a0cb956966c9a97a71bbfb83b42bd67", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19095, "upload_time": "2019-01-14T06:36:13", "url": "https://files.pythonhosted.org/packages/cc/dd/db3a1a771273533c4e9227ef82d427a017a8d03e3d1678e48335bb2aa2a5/showdownpy-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "e5180dc17abbc4f522449adfc2a1b7d7", "sha256": "63427d393ea5a029f2fc5d24dd9759a13036a066684243818f4829b94112d783" }, "downloads": -1, "filename": "showdownpy-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "e5180dc17abbc4f522449adfc2a1b7d7", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 21650, "upload_time": "2019-01-14T20:14:34", "url": "https://files.pythonhosted.org/packages/1f/8e/e94bf524d77ccd0432b3751e57af913027ced9f0220ea1af8baceaea5b7d/showdownpy-0.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "26056b7dec4c8c47d1a70085b6bc1363", "sha256": "0da36a153d0b3cd7d1e606ff63b8fd483b88b4fe55f51fd24ca83a7eab9597e3" }, "downloads": -1, "filename": "showdownpy-0.1.1.tar.gz", "has_sig": false, "md5_digest": "26056b7dec4c8c47d1a70085b6bc1363", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18335, "upload_time": "2019-01-14T20:14:36", "url": "https://files.pythonhosted.org/packages/5c/1a/9ade95cfa60a75dea5b0313b241919df6d118969b821b2a30b75bebd3259/showdownpy-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "0af4c434d1775124870acd9eb008c47a", "sha256": "789121ff32f59f4193b8f4191069c0bab5147a64239f15cf0aa54f36bd0738d4" }, "downloads": -1, "filename": "showdownpy-0.1.2-py3-none-any.whl", "has_sig": false, "md5_digest": "0af4c434d1775124870acd9eb008c47a", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 23825, "upload_time": "2019-01-17T08:25:55", "url": "https://files.pythonhosted.org/packages/6e/2e/e3f962c1953bb71a24482355a838762b0dfe77a884c6ff7ce19730b28493/showdownpy-0.1.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a20f6c04b1c0526da0fc51aff40f1ef5", "sha256": "aabbae03899bb3c64c59a1ed17b99f4e90720ccd74f2ca978a6cfcdbb12e45d1" }, "downloads": -1, "filename": "showdownpy-0.1.2.tar.gz", "has_sig": false, "md5_digest": "a20f6c04b1c0526da0fc51aff40f1ef5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 20267, "upload_time": "2019-01-17T08:25:57", "url": "https://files.pythonhosted.org/packages/15/6f/1c6a2dc909afc517ff0015e0be2559dd53acf627a310df56a2fdfa1f290c/showdownpy-0.1.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "0af4c434d1775124870acd9eb008c47a", "sha256": "789121ff32f59f4193b8f4191069c0bab5147a64239f15cf0aa54f36bd0738d4" }, "downloads": -1, "filename": "showdownpy-0.1.2-py3-none-any.whl", "has_sig": false, "md5_digest": "0af4c434d1775124870acd9eb008c47a", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 23825, "upload_time": "2019-01-17T08:25:55", "url": "https://files.pythonhosted.org/packages/6e/2e/e3f962c1953bb71a24482355a838762b0dfe77a884c6ff7ce19730b28493/showdownpy-0.1.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a20f6c04b1c0526da0fc51aff40f1ef5", "sha256": "aabbae03899bb3c64c59a1ed17b99f4e90720ccd74f2ca978a6cfcdbb12e45d1" }, "downloads": -1, "filename": "showdownpy-0.1.2.tar.gz", "has_sig": false, "md5_digest": "a20f6c04b1c0526da0fc51aff40f1ef5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 20267, "upload_time": "2019-01-17T08:25:57", "url": "https://files.pythonhosted.org/packages/15/6f/1c6a2dc909afc517ff0015e0be2559dd53acf627a310df56a2fdfa1f290c/showdownpy-0.1.2.tar.gz" } ] }