# Slaccato
> Structured Slack bot framework
## Installation
```shell
$ pip install slaccato
```
## Example
### General Usage
```python
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, user_command, request_user):
response = 'Oh, {}! here I am!!!'.format(request_user)
return channel, response
slack_bot = slaccato.SlackBot(
slack_bot_token='SLACK_BOT_TOKEN',
slack_bot_name='SLACK_BOT_NAME',
std_out_path='/path/to/MY_LOG_FILE.log',
std_err_path='/path/to/MY_ERR_FILE.log')
slack_bot.add_method(TestMethod)
slack_bot.run()
```

### Message Customization
Please see [Slack API documentations](https://slack.dev/python-slackclient/basic_usage.html#customizing-a-message-s-layout)
```python
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, 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, response
```

> Structured Slack bot framework
## Installation
```shell
$ pip install slaccato
```
## Example
### General Usage
```python
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, user_command, request_user):
response = 'Oh, {}! here I am!!!'.format(request_user)
return channel, response
slack_bot = slaccato.SlackBot(
slack_bot_token='SLACK_BOT_TOKEN',
slack_bot_name='SLACK_BOT_NAME',
std_out_path='/path/to/MY_LOG_FILE.log',
std_err_path='/path/to/MY_ERR_FILE.log')
slack_bot.add_method(TestMethod)
slack_bot.run()
```

### Message Customization
Please see [Slack API documentations](https://slack.dev/python-slackclient/basic_usage.html#customizing-a-message-s-layout)
```python
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, 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, response
```

Release files for slaccato 0.1.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| slaccato-0.1.8-py3-none-any.whl | Python 3 | none | any | Details |
| slaccato-0.1.8-py2-none-any.whl | Python 2 | none | any | Details |
Total release size:13.1 kB
Release files / slaccato-0.1.8-py3-none-any.whl
| Download URL | slaccato-0.1.8-py3-none-any.whl |
|---|---|
| Size | 6.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1c3164bec7b6f6721af446ed7f9800fcdc8cce70483d17bbf89b16da61b38a33
|
|
BLAKE2b-256 checksum How to use checksums |
4f107428ebf22a5d4c7ae6b5a368950bd6ab40ee7616843915ea4c3820c664eb
|
| 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
|
Release files / slaccato-0.1.8-py2-none-any.whl
| Download URL | slaccato-0.1.8-py2-none-any.whl |
|---|---|
| Size | 6.6 kB |
| Tags | Python 2 |
|
SHA-256 checksum How to use checksums |
cbf64a6933a663ee0408f9dc5f35b1f1fed9bbe63fddae70331c6a58d8b43236
|
|
BLAKE2b-256 checksum How to use checksums |
4ae034d897f4ec91565f71146ba7957e49495a66f1e0157b8d25dab18215b7bb
|
| 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
|