{"id":18015250,"url":"https://github.com/lettier/slackotron","last_synced_at":"2025-03-26T18:31:07.203Z","repository":{"id":27270538,"uuid":"30743404","full_name":"lettier/slackotron","owner":"lettier","description":"A plugin extensible Slack bot.","archived":false,"fork":false,"pushed_at":"2022-12-26T19:48:02.000Z","size":249,"stargazers_count":16,"open_issues_count":10,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-22T06:27:38.639Z","etag":null,"topics":["chatbot","chatbots-framework","flask","natural-language-processing","plugin-system","plugins","python","rabbitmq","rabbitmq-consumer","slack","slack-bot"],"latest_commit_sha":null,"homepage":"https://api.slack.com/community#python","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lettier.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-02-13T06:22:53.000Z","updated_at":"2023-10-26T14:19:13.000Z","dependencies_parsed_at":"2023-01-14T06:21:07.023Z","dependency_job_id":null,"html_url":"https://github.com/lettier/slackotron","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lettier%2Fslackotron","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lettier%2Fslackotron/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lettier%2Fslackotron/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lettier%2Fslackotron/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lettier","download_url":"https://codeload.github.com/lettier/slackotron/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245712595,"owners_count":20660266,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chatbot","chatbots-framework","flask","natural-language-processing","plugin-system","plugins","python","rabbitmq","rabbitmq-consumer","slack","slack-bot"],"created_at":"2024-10-30T04:13:15.826Z","updated_at":"2025-03-26T18:31:06.775Z","avatar_url":"https://github.com/lettier.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Slackotron](docs/img/logo.png)\n\n# Slackotron\n\nA [Slack](https://www.slack.com/) bot extendable via plugins.\n\n## Screenshots\n\n![](http://i.imgur.com/w6YAs7T.png)  \n![](http://i.imgur.com/BsrBCPZ.jpg)  \n![](http://i.imgur.com/hgBarlS.png)  \n![](http://i.imgur.com/YQ4mcrH.jpg)  \n![](http://i.imgur.com/LMgs9r9.png)  \n![](http://i.imgur.com/FYkKKwX.png)  \n\n## Quick Start\n\n```bash\n# Install Python2.\n# Install JDK 8.\n# Install and run Redis.\n# Install and run RabbitMQ.\n# Download the Stanford Parser and NER (see dependencies below).\npython2_location=$(which python2) # Arch Linux\npython2_location=$(which python) # Ubuntu or Mac OSX\nvirtualenv --no-site-packages --python=$python2_location --always-copy \\\nslackotron_venv\ncd slackotron_venv/\nsource ./bin/activate\n# Clone this Git repository.\ngit clone\ncd slackotron/\n# Install the needed Python modules.\npip install -r requirements.txt\n# Install the Berkeley SQLite DB\ncd ../lib/python2.7/site-packages/playhouse/\n./berkeley_build.sh\ncd ../../../../slackotron/\n# Create the Slackotron settings file.\ncp src/slackotron_settings.py.template src/slackotron_settings.py\n# Fill in your specific settings.\n# Look for:\n#   - Slack API Token\n#   - Bot Slack Name\n#   - Bot Icon URL\n#   - Bot Emoji\n#   - Java Home Location\n#     - Mac users:\n#       - JAVA_HOME='/Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home/bin/'\n#   - Stanford Parser Location\n#   - Stanford Parser Models Location\n#   - Stanford NER Location\n#   - Stanford NER Classifier Location\ncd src/plugins/\n# For each plugin in plugins.\n  cd plugin_name/\n  # Create the plugin settings file.\n  cp plugin_name_settngs.py.template plugin_name_settings.py\n  # Fill in your specific settings.\ncd ../../\npython src/slackotron.py\n# Point your browser to http://localhost:55555/\n# to use the dashboard.\n# Visit http://localhost:55555/channels to subscribe\n# to the channels you wish.\n```\n\n## Architecture Overview\n\n### Models\n\nSlackotron has its own internal models that are stored in a\n Berkeley SQLite database (DB).\nThe models include message, user, channel, and response.\nA message has one user and channel.\nA channel has many users and messages.\nA channel can either be a Slack channel or direct-message (DM).\nA user has many channels and messages.\nA response has one message, user, and channel.\n\n### Threads\n\nThe main Slackotron process (MSP) initializes the Channel User Manager\n which starts a thread that in turn runs the channel subscribers and publishers.\nChannel subscribers pull in the latest raw Slack messages, generating\n Slackotron messages, for their channel.\nUpon message generation, a channel subscriber publishes a RabbitMQ (RMQ)\n message to the Slackotron plugins exchange (SPE).\nThis RMQ message contains the Slackotron message, channel, and user ID.\nSince the plugins exchange is fanout, all plugin queues receive the same RMQ message.\nChannel publishers query the DB for all approved unsent responses for their channel.\nPer approved unsent response, a channel publisher posts the response's text\n to their Slack DM or channel and marks the response as sent.\nChannel subscribers and publishers are added or removed during runtime based on\n the selections on the dashboard channels page.\n\nIn addition to the channel subscribers/publishers thread, the Plugin Manager\n initializes a thread which turns plugin responses from RabbitMQ into persisted\n responses stored in the DB.\nThese responses will be picked up by the channel subscribers/publishers thread.\n\n### Plugins\n\nThe majority of Slackotron's functionality resides with its plugins.\nEach plugin runs in its own process upon initialization and\n has its own RMQ queue attached to the SPE.\nBased on a plugin's configuration, a Slackotron message's text may activate a plugin.\nUpon activation, a plugin performs some operation and may or may not send a RMQ message\n to the main Slackotron RMQ exchange and subsequent queue.\nPlugin RMQ messages contain the plugin's response text.\nThe MSP dequeues these RMQ messages and generates responses.\n\n### Security\n\nSlackotron employs a level of security per each of its channels.\nWith security on, responses must be approved by the bot operator via\n the dashboard.\nEach response's text is scrubbed of profanity if PROFANITY_FILTER_ON\n is set to true in the settings.\nWithin the dashboard, security per channel can be either turned off or on.\n\n### Dashboard\n\nThe Slackotron dashboard is initialized upon boot of the MSP and\n runs in its own process.\nThe underlying technology is a Flask application that listens on port 55555\n by default.\nThe dashboard has four main pages.\nThe first page is an overview of the Slack DMs, channels, and users\n that Slackotron knows about.\nThe second page lists the responses awaiting approval.\nIt is here that responses can be approved or deleted.\nThe third page lists the Slackotron channels.\nIt is here that the bot operator can either turn off or on a\n channel's security and/or subscribe to individual channels.\nThe slackbot channel is subscribed by default.\nThe fourth page allows the bot operator to post a message to a Slack\n DM or channel and user.\nMessages posted from the dashboard will contain the text \"\\[ADMIN\\]\"\n in Slack.\n\n### An Example\n\nJane posts a message \"Hello Slackotron!\" to the Slack channel named general.\nThe channel subscriber, for general, generates a message with ID 0.\nMessage, with ID 0, has user with ID 1 and channel with ID 2.\nThe channel subscriber sends the RMQ message\n \"{channel_id: 2, user_id: 1, message_id: 0}\" to the SPE.\nPlugin 0 dequeues and queries for message, user, and channel with ID 0,\n 1, and 2 respectively.\nPlugin 0 is not activated.\nPlugin 1 does the same and is activated.\nPlugin 1 sends the RMQ message\n \"{channel_id: 2, user_id: 1, message_id: 0, response_text: \"Hello!}\" to\n the main Slackotron RMQ exchange.\nThe MSP dequeues and generates a response with ID 3 and text \"@jane, Hello!\".\nSecurity is on for channel, with ID 2, so the response is marked not approved.\nThe bot operator goes to http://localhost:55555/pending_responses/ and sees\n the awaiting response.\nThe bot operator approves the response.\nThe channel publisher queries for unsent approved responses for channel with ID 2.\nResponse, with ID 3, is returned.\nThe channel publisher posts \"@jane, Hello!\" to the Slack channel named general\n and marks the response, with ID 3, as sent.\n\n## Dependencies\n\n* OS\n  * [JDK 8](http://openjdk.java.net/install/)\n  * [Python2](https://www.python.org/downloads/)\n  * [Redis](http://redis.io/download)\n  * [RabbitMQ](https://www.rabbitmq.com/download.html)\n  * [Stanford Parser version 3.4.1](http://nlp.stanford.edu/software/lex-parser.shtml)\n  * [Stanford Named Entity Recognizer version 3.4](http://nlp.stanford.edu/software/CRF-NER.shtml)\n* Python\n  * BeautifulSoup\n  * Colorama\n  * Httplib2\n  * Flask\n  * NLTK\n  * Numpy\n  * Pattern\n  * Peewee\n  * Pika\n  * Redis\n  * Requests\n\n_(C) 2015 David Lettier._  \nhttp://www.lettier.com/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flettier%2Fslackotron","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flettier%2Fslackotron","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flettier%2Fslackotron/lists"}