here is some context, im staring to use the slack BOLD SDK for python and while the guide is great... posting those gigantic block of code for the block kit part is a mess so I want to create a new class/function and import it .. so, instead of this:
main.py
-------
@app.message("hello")
def message_hello(message, say):
# say() sends a message to the channel where the event was triggered
say(
blocks=[
{
"type": "section",
"text": {"type": "mrkdwn", "text": f"Hey there <@{message['user']}>!"},
"accessory": {
"type": "button",
"text": {"type": "plain_text", "text": "Click Me"},
"action_id": "button_click"
}
}
],
text=f"Hey there <@{message['user']}>!"
)
I can do this:
msg.py:
--------
def hello():
return blocks=[
{
"type": "section",
"text": {"type": "mrkdwn", "text": f"Hey there <@{message['user']}>!"},
"accessory": {
"type": "button",
"text": {"type": "plain_text", "text": "Click Me"},
"action_id": "button_click"
}
}
],
text=f"Hey there <@{message['user']}>!"
main.py
--------
import from lib msg
@app.message("hello")
def message_hello(message, say):
# say() sends a message to the channel where the event was triggered
say(msg.hello())
Its been a while since I used Python last time and im having issues with the return part at msg.py
.. I tried to put the code between single quotes, double quotes, triple double quotes, ticks, parenthesis, curly braces.. nothing works..
anyone can refresh my memory and help me?.
Thanks!