{ "info": { "author": "penta515", "author_email": "penta0515@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "# slash-command-decorator\nslash-command-decorator is a simple decorator for the use of AWS Lambda as the [Slack Slash Command](https://api.slack.com/slash-commands) backend.\n\n[![CircleCI](https://circleci.com/gh/penta515/slash-command-decorator.svg?style=svg)](https://circleci.com/gh/penta515/slash-command-decorator) [![Code Climate](https://codeclimate.com/github/penta515/slash-command-decorator/badges/gpa.svg)](https://codeclimate.com/github/penta515/slash-command-decorator)\n\n## Installation\nThe latest release of slash-command-decorator can be installed via pip\n\n```\n$ pip install slash-command-decorator\n```\n\nAn alternative install method would be manually installing it leveraging `setup.py`\n\n```\n$ git clone https://github.com/penta515/slash-command-decorator\n$ cd slash-command-decorator\n$ python setup.py install\n```\n\n## Set Query String in event\n\nIn handler function `event.body` parameter, it is necessary to set up URL query string that was tranmitted by Slack \n\n\n###Example event.body\n\n```python\n\"token=aCec9XZPS6klbnAAAAAAAAAA&team_id=T0AAAAAAA&team_domain=test-domain&channel_id=C0AAAAAAA&channel_name=general&user_id=U0AAAAAAA&user_name=hoge&command=%2Fcommand&text=hoge&response_url=https%3A%2F%2Fhooks.slack.com%2Fcommands%2FT0JQU92NA%2F1234567890%2Faaaaaaaaaaaaaaaaaaa\"\n```\n\n## Usage examples\nUsage examples are included in the [samples directory](https://google.co.jp)\n\n```python\nfrom slash_command_decorator.slash_command import SlashCommand\nfrom slash_command_decorator import (\n lambda_manager,\n respond_to_option\n)\n\nSLACK_API_TOKEN = \"xoxp-12345678901-12345678901-12345678901-hogefugapiyo\"\nCONFIG = {\n \"username\": \"Slash Command\",\n \"icon_emoji\": \":penguin:\"\n}\n\n@lambda_manager\ndef lambda_handler(event, context):\n @respond_to_option(\"^help$\")\n def help_option(reaction):\n reaction.ephemeral(\"HELP!\")\n\n @respond_to_option(\"^hoge$\")\n def hoge_option(reaction):\n reaction.in_channel(\"HOGE!\")\n\n @respond_to_option(\"^fuga$\")\n def fuga_option(reaction):\n reaction.send(\"FUGA!\")\n\n @respond_to_option(\"^piyo$\")\n def piyo_option(reaction):\n reaction.reply(\"PIYO!\")\n\n SlashCommand(\n token=SLACK_API_TOKEN,\n config=CONFIG\n ).start(\n help_option,\n hoge_option,\n fuga_option,\n piyo_option\n )\n```\n\n###Types of Responses\n####1.ephemeral \n \n```python\n@respond_to_option(\"^help$\")\ndef help_option(reaction):\n reaction.ephemeral(\"HELP!\")\n```\n\n![ephemeral](https://github.com/penta515/slash-command-decorator/blob/develop/images/help.gif)\n\n####2.in_channel\n\n```python\n@respond_to_option(\"^hoge$\")\ndef hoge_option(reaction):\n reaction.in_channel(\"HOGE!\")\n```\n\n![in_channel](https://github.com/penta515/slash-command-decorator/blob/develop/images/hoge.gif)\n\n####3.send\n\n```python\n@respond_to_option(\"^fuga$\")\ndef fuga_option(reaction):\n reaction.send(\"FUGA!\")\n```\n\n![in_channel](https://github.com/penta515/slash-command-decorator/blob/develop/images/fuga.gif)\n\n####4.reply\n\n```python\n@respond_to_option(\"^PIYO$\")\ndef piyo_option(reaction):\n reaction.reply(\"PIYO!\")\n```\n\n![in_channel](https://github.com/penta515/slash-command-decorator/blob/develop/images/piyo.gif)\n\n## Running tests\n\n```\n$ py.test tests\n```\n\n## License\n\n[![MIT License](http://img.shields.io/badge/license-MIT-blue.svg?style=flat)](LICENSE)", "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/penta515/slash-command-decorator", "keywords": null, "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "slash-command-decorator", "package_url": "https://pypi.org/project/slash-command-decorator/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/slash-command-decorator/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/penta515/slash-command-decorator" }, "release_url": "https://pypi.org/project/slash-command-decorator/0.0.3/", "requires_dist": null, "requires_python": null, "summary": "Useful Slack Slash Command decorators for AWS Lambda.", "version": "0.0.3" }, "last_serial": 2199201, "releases": { "0.0.2": [], "0.0.3": [ { "comment_text": "", "digests": { "md5": "bbe3fb5f216dc5c63945ac56a897cfb1", "sha256": "3be01d01569c0832269ea862f74179d002a4ddbb495a1af389051a3c53931298" }, "downloads": -1, "filename": "slash_command_decorator-0.0.3-py2-none-any.whl", "has_sig": false, "md5_digest": "bbe3fb5f216dc5c63945ac56a897cfb1", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 6867, "upload_time": "2016-07-02T05:07:44", "url": "https://files.pythonhosted.org/packages/0a/61/996588a127ab48d84c42b5ba8e733eaad2094b5d9b2c616d7373e4b04cc4/slash_command_decorator-0.0.3-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e212df3276e1bde7a92604d67da04862", "sha256": "bf0ce9901d468d95b9a063ad0af0b212806ba0ad6736766c60d912eea28791a3" }, "downloads": -1, "filename": "slash-command-decorator-0.0.3.tar.gz", "has_sig": false, "md5_digest": "e212df3276e1bde7a92604d67da04862", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3839, "upload_time": "2016-07-02T05:07:38", "url": "https://files.pythonhosted.org/packages/87/7e/a7518c25b8fa4d054ae4ffcb24901d1459db31ddf66ae352abe812cfcc40/slash-command-decorator-0.0.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "bbe3fb5f216dc5c63945ac56a897cfb1", "sha256": "3be01d01569c0832269ea862f74179d002a4ddbb495a1af389051a3c53931298" }, "downloads": -1, "filename": "slash_command_decorator-0.0.3-py2-none-any.whl", "has_sig": false, "md5_digest": "bbe3fb5f216dc5c63945ac56a897cfb1", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 6867, "upload_time": "2016-07-02T05:07:44", "url": "https://files.pythonhosted.org/packages/0a/61/996588a127ab48d84c42b5ba8e733eaad2094b5d9b2c616d7373e4b04cc4/slash_command_decorator-0.0.3-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e212df3276e1bde7a92604d67da04862", "sha256": "bf0ce9901d468d95b9a063ad0af0b212806ba0ad6736766c60d912eea28791a3" }, "downloads": -1, "filename": "slash-command-decorator-0.0.3.tar.gz", "has_sig": false, "md5_digest": "e212df3276e1bde7a92604d67da04862", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3839, "upload_time": "2016-07-02T05:07:38", "url": "https://files.pythonhosted.org/packages/87/7e/a7518c25b8fa4d054ae4ffcb24901d1459db31ddf66ae352abe812cfcc40/slash-command-decorator-0.0.3.tar.gz" } ] }