{ "info": { "author": "Rick Henry", "author_email": "fredericmhenry@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Topic :: Communications :: Chat" ], "description": "slackmentions\n=============\nProvides functions for dealing with mentions in slack messages.\n\nInstallation\n============\n``$ pip install slackmentions``\n\nYou will also need the `slackclient\n`_ package for this to be\nuseful.\n\nUsage\n=====\nAvailable functions:\n\nfindpeople:\n Finds username mentions in slack text and creates `SlackPerson\n `_ objects\n for those people. Returns a list of those SlackPerson objects.\n This can be used to get more information about users or if the same text\n will be processed multiple times.\n\n Arguments:\n\n text: text to find @ mentions in.\n\n userlist: output of slack api users.list\n\n silent: slackperson.SlackDataError will be raised if a mention is found\n in the text but not in the userlist. Setting to True will swallow this\n error and ignore that mention.\n\n Returns: List of SlackPerson objects or empty list.\n\nmention_text:\n Replaces username mentions in text with user id mentions for tagging by\n slack api message sending.\n\n Arguments:\n\n text: The text containing @ mentions\n\n people: A list of SlackPerson objects for people found in the text. If not\n specified, one will be generated by passing text and userlist to\n findpeople. Required if userlist is not provided.\n\n userlist: The json from slack api users.list. Required if people is not\n provided.\n\n silent: slackperson.SlackDataError will be raised if a mention is found\n in the text but not in the userlist. Setting to True will swallow this\n error and ignore that mention. Only applies if userlist is specified, not\n people.\n\nclean_text:\n Deletes @ mentions from text\n Arguments:\n\n text: The text containing @ mentions\n\n people: A list of SlackPerson objects for people found in the text. If not\n specified, one will be generated by passing text and userlist to\n findpeople. Required if userlist is not provided.\n\n userlist: The json from slack api users.list. Required if people is not\n provided.\n\n silent: slackperson.SlackDataError will be raised if a mention is found\n in the text but not in the userlist. Setting to True will swallow this\n error and ignore that mention. Only applies if userlist is specified, not\n people.\n\n clean_all: set to true to ignore the user lists and people and just nuke\n all the mentions\n\n\n.. code::\n\n import slackmentions\n from slackclient import SlackClient\n\n sc = SlackClient(os.environ['SLACK_API_TOKEN'])\n userlist = sc.api_call('users.list')\n text = 'hi @joe, could you tell @kathy to call me?'\n\n people = slackmentions.findpeople(text, userlist)\n # people = [SlackPerson(userid='U0000001', username='joe'),\n SlackPerson(userid='U0000002', username='kathy')]\n withmentions = slackmentions.mention_text(text, people=people)\n # withmentions = 'hi <@U0000001>, could you please tell <@U0000002> to call\n me?'\n withmentions2 = slackmentions.mention_text(text, userlist=userlist)\n assert withmentions = withmentions2\n\n cleantext = slackmentions.clean_text(text, people=people)\n # cleantext = 'hi, could you please tell to call me?'\n\nTests\n=====\nThere are tests for each method with successes, errors raised, errors\nswallowed, and missing keyword arguments. They can be run with ``pytest``.\n\n\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/rickh94/slackmentions", "keywords": "slack,text,messages,mentions", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "slackmentions", "package_url": "https://pypi.org/project/slackmentions/", "platform": "", "project_url": "https://pypi.org/project/slackmentions/", "project_urls": { "Homepage": "https://github.com/rickh94/slackmentions" }, "release_url": "https://pypi.org/project/slackmentions/0.1.2/", "requires_dist": [ "slackperson" ], "requires_python": ">=3", "summary": "Some functions for dealing with mentions in slack messages", "version": "0.1.2" }, "last_serial": 3116747, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "83b2d3b5cb4da2a3191c2cac07ab556e", "sha256": "554dfd90bfc29ab167f6792273d28f1ef9b0fb8be476c28f45dca6bd3da8851e" }, "downloads": -1, "filename": "slackmentions-0.1-py3-none-any.whl", "has_sig": true, "md5_digest": "83b2d3b5cb4da2a3191c2cac07ab556e", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3", "size": 5402, "upload_time": "2017-08-22T05:29:49", "url": "https://files.pythonhosted.org/packages/35/8a/f56b2415c86679f7cfcdcbe1360590ca9df434ee918ee7ce781b26a0459d/slackmentions-0.1-py3-none-any.whl" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "b20700934ea6faa907893865af3d57b1", "sha256": "2f85c609ce7ff3a18cb3355c28812f23a78faeaf97e40555ca13ae9f3460f8ae" }, "downloads": -1, "filename": "slackmentions-0.1.1-py3-none-any.whl", "has_sig": true, "md5_digest": "b20700934ea6faa907893865af3d57b1", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3", "size": 5429, "upload_time": "2017-08-23T07:13:08", "url": "https://files.pythonhosted.org/packages/7f/c0/b56647eb12a6492886a3185b9a47195443a9ed6e0bbfb9729b5cd35ee8f3/slackmentions-0.1.1-py3-none-any.whl" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "14db8424486dddfa3e8adffdb50e2ae4", "sha256": "9460d213cefa3fd79def6f3bf0e3fb94e8330744d3314071e9925337e5f7cc6f" }, "downloads": -1, "filename": "slackmentions-0.1.2-py3-none-any.whl", "has_sig": true, "md5_digest": "14db8424486dddfa3e8adffdb50e2ae4", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3", "size": 5441, "upload_time": "2017-08-23T07:21:07", "url": "https://files.pythonhosted.org/packages/bf/1b/fddc44fe666459456e15d2a5b7702fc63f02d8a3014a3bee5296bd522320/slackmentions-0.1.2-py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "14db8424486dddfa3e8adffdb50e2ae4", "sha256": "9460d213cefa3fd79def6f3bf0e3fb94e8330744d3314071e9925337e5f7cc6f" }, "downloads": -1, "filename": "slackmentions-0.1.2-py3-none-any.whl", "has_sig": true, "md5_digest": "14db8424486dddfa3e8adffdb50e2ae4", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3", "size": 5441, "upload_time": "2017-08-23T07:21:07", "url": "https://files.pythonhosted.org/packages/bf/1b/fddc44fe666459456e15d2a5b7702fc63f02d8a3014a3bee5296bd522320/slackmentions-0.1.2-py3-none-any.whl" } ] }