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 new Slack message posts whose ['text'] value is equivalent to the provided string argument
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...
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).
Release History
- 1.0.0
- first release
- 1.0.1
- minor README changes
- 1.0.2
- minor README changes
- 1.0.3
- use nonlocal variables to remove the need for a recursive call on decorated function
- remove polling, add while True
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.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 59a5af56e98585fb5aa0f92a0f675331a0dca93b3e4c3070fe18880edff939e9 |
|
MD5 | 3a7979d78617d75f5563931850c0ee0e |
|
BLAKE2b-256 | 0fc5387c6d77d33ba734e924fbab231489dee3e3352a611cb565c01ff32c55b6 |