---
title: "Automate the Boring Stuff with Slackbot(ver.2) - Takanori Suzuki"
tags: PyConTW2023, 2023-organize, 2023-共筆
---
# Automate the Boring Stuff with Slackbot(ver.2) - Takanori Suzuki
{%hackmd H6-2BguNT8iE7ZUrnoG1Tg %}
<iframe src=https://app.sli.do/event/nfvdHpL8HvQTyLz4bQkUUz height=450 width=100%></iframe>
> Collaborative writing start from below
> 從這裡開始共筆
[Slide](https://slides.takanory.net)
## Why Slack?
[Slack Website](https://slack.com/intl/zh-tw)
## Slack Bolt
https://slack.dev/bolt-python/concepts
## Q&A
### What is the best Practice for complex code structures?
A: You should write a decorator function inside of `enable_plugin` function.
see also: https://github.com/pyconjp/pyconjpbot2/blob/2c6ca60d86af715837b1c73e786de800014f02b2/plugins/calc.py#L15-L22
```python
def enable_plugin(app: App) -> None:
@app.message(compile(r"^(([-+*/^%!(),.\d\s]|pi|e|sqrt|sin|cos|tan|log)+)$"))
def calc(message: dict, say: Say) -> None:
"""
Calculate a string like a formula and return the result
"""
```
Below is the part that speaker updated the talk/tutorial after speech
講者於演講後有更新或勘誤投影片的部份