Skip to main content

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
  • 1.0.4
    • Add try/except with error message for import local_settings
    • Add license copy
  • 1.0.5
    • add exception handling

Meta

James Coleman – jamescoleman@me.com

Distributed under the MIT license. See LICENSE for more information.

gitlab.com/jamescoleman/slacktory

Contributing

  1. Fork it (https://gitlab.com/j9mes/slacktory/forks/new)
  2. Create your feature branch (git checkout -b feature/fooBar)
  3. Commit your changes (git commit -am 'Add some fooBar')
  4. Push to the branch (git push origin feature/fooBar)
  5. 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

slacktory-1.0.5.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

slacktory-1.0.5-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file slacktory-1.0.5.tar.gz.

File metadata

  • Download URL: slacktory-1.0.5.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

File hashes

Hashes for slacktory-1.0.5.tar.gz
Algorithm Hash digest
SHA256 fa06c9ce6ea18c3421f8a4905acc9e90fc12816c0c20bb2d0517dc330d597918
MD5 dc50fca046ee438e75ce3725de033d15
BLAKE2b-256 8c3e278a89a3630819c7c58599b1582a007ca14399f4203bb7ba32cce65be421

See more details on using hashes here.

File details

Details for the file slacktory-1.0.5-py3-none-any.whl.

File metadata

  • Download URL: slacktory-1.0.5-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

File hashes

Hashes for slacktory-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 bc8fa4860e3c8733f1a8ab4d6b84b4c7d80d5e284a11db4542a88e3e230865ea
MD5 c86632df8a6faed8fcb86874ed61742b
BLAKE2b-256 aea7e30b6ba3cafd0ff12c0f2e79f2d263a7284503303d62e3093ac1af05608b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page