Skip to main content

slouch

Slouch is a lightweight Python framework for building cli-inspired Slack bots.

Here’s an example bot built with Slouch:

from slouch import Bot, help

class PingBot(Bot):
    pass

@PingBot.command
def pingme(opts, bot, event):
    """Usage: pingme [--message=<message>]

    Respond with an at-mention to the sender.

    Pass _message_ to include a message in the response.
    """

    sender_slack_id = event['user']
    message = opts['<message>']
    response = ""

    if message is not None:
        response = message

    return "<@%s> %s" % (sender_slack_id, response)

And here’s a test for that bot:

from slouch import testing

class TestPingBot(CommandTestCase):

    bot_class = PingBot

    def test_ping(self):
        response = self.send_message('pingme', user='123')
        self.assertEqual(response, '<@123> ')

Install with pip install slouch. Run tests with py.test tests.

For more details, check out the docs at https://slouch.readthedocs.io or see a full example bot.

Metadata

Release files for slouch 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for slouch 0.5.0
File Size Uploaded Provenance
slouch-0.5.0.tar.gz 7.0 kB Without provenance Details

Release files / slouch-0.5.0.tar.gz

Download URL slouch-0.5.0.tar.gz
Size 7.0 kB
Tags Source
SHA-256 checksum
How to use checksums
53e43fb051a4f05987f661c3c101c5a4a11520ef54849a915246a66d2a1fbc05
BLAKE2b-256 checksum
How to use checksums
c79f5759c9bc47a8fe7e1abc37f937f0391d7778749779907d1e5971f8b80f63
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for slouch 0.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page