Skip to main content

Slaccato

Structured Slack bot framework

Installation

$ pip install slaccato

Example

General Usage

import slaccato

# Write a new method
class TestMethod(slaccato.SlackMethod):
    @property
    def execution_words(self):
        return ['테스트', 'test', 'ping']

    @property
    def help_text(self):
        return '*{}*: You can test me!'.format('/'.join(self.execution_words))

    def response(self, channel, thread_ts, user_command, request_user):
        response = 'Oh, {}! here I am!!!'.format(request_user)
        return channel, thread_ts, response

slack_bot = slaccato.SlackBot(
    slack_bot_token='SLACK_BOT_TOKEN',
    slack_bot_name='SLACK_BOT_NAME',
    # Optional. Use default logger
    logger=None,
)

slack_bot.add_method(TestMethod)
slack_bot.run()

Test screenshot

Message Customization

Please see Slack API documentations

import slaccato

# Write a new method
class TestMethod(slaccato.SlackMethod):
    @property
    def execution_words(self):
        return ['테스트', 'test', 'ping']

    @property
    def help_text(self):
        return '*{}*: You can test me!'.format('/'.join(self.execution_words))

    def response(self, channel, thread_ts, user_command, request_user):
        response = [
            {
                "type": "section",
                "text": {
                    "type": "mrkdwn",
                    "text": "Danny Torrence left the following review for your property:"
                }
            },
            {
                "type": "section",
                "text": {
                    "type": "mrkdwn",
                    "text": "<https://example.com|Overlook Hotel> \n :star: \n Doors had too many axe holes, guest in room " +
                    "237 was far too rowdy, whole place felt stuck in the 1920s."
                },
                "accessory": {
                    "type": "image",
                    "image_url": "https://images.pexels.com/photos/750319/pexels-photo-750319.jpeg",
                    "alt_text": "Haunted hotel image"
                }
            },
            {
                "type": "section",
                "fields": [
                    {
                        "type": "mrkdwn",
                        "text": "*Average Rating*\n1.0"
                    }
                ]
            }
        ]
        return channel, thread_ts, response

Test screenshot

LICENSE

Metadata

Release files for slaccato 0.2.1

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

Built distribution (wheel)

Table of built distributions (wheels) for slaccato 0.2.1
File Interpreter ABI Platform Actions
slaccato-0.2.1-py3-none-any.whl Python 3 none any Details for slaccato-0.2.1-py3-none-any.whl

Release files / slaccato-0.2.1-py3-none-any.whl

Download URL slaccato-0.2.1-py3-none-any.whl
Size 7.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b0f6c2a1b56f7dc197dec025b35924332a4ee2bb5ff87b6861a6cdc4da65d9c9
BLAKE2b-256 checksum
How to use checksums
7e99857c391835214358de6e82a9b745d0120078776a2dcdc5349826e55cfca5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.0

Security for slaccato 0.2.1

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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