Simple Slack interface
Project description
Slacktory
A decorator which is called using:
@slacktory.watch('the text to watch for')
...that watches a specified Slack channel for the provided text argument in a new Slack post message
Requires Python 3.7
Installation
pip install slacktory
For this decorator to work, you must first create a Slack App
Then create a local_settings.py file in your project's root directory with the following content:
name = '<your slack channel name>'
channel = '<your slack channel id>'
token = '<your slack API token>'
webhook = '<your slack channel webhook>'
All of the above information can be obtained when setting up your Slack App
Usage example
>>> import slacktory
>>> @slacktory.watch('do the thing') # the decorator
>>> def the_thing():
# do something here...
the_thing()
In the above example, the_thing() will be called once the @slacktory.watch decorator has detected the text 'do the thing' in a new slack message in the slack channel (specified in local_settings.py).
Note the recursive call to the_thing() inside def the_thing(): . Currently this must be placed after the action inside the function in order to reset the watch on the Slack channel. I would be grateful for any help to take care of this step inside the decorator!
Release History
- 0.0.1
- first release
Meta
James Coleman – jamescoleman@me.com
Distributed under the MIT license. See LICENSE
for more information.
gitlab.com/jamescoleman/slacktory
Contributing
- Fork it (https://gitlab.com/j9mes/slacktory/forks/new)
- Create your feature branch (
git checkout -b feature/fooBar
) - Commit your changes (
git commit -am 'Add some fooBar'
) - Push to the branch (
git push origin feature/fooBar
) - Create a new Pull Request
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for slacktory-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fe16e362d39d0a518d0ae3bbc3bcfaf3357de8d1ab093f07a06a6e6365859ba5 |
|
MD5 | f6121e74e219bbe9b3437985d803a74a |
|
BLAKE2b-256 | 369c9a1fc487063c2b7cfc1d79401d0dad4cba244acdbf46cc92275592733275 |