Skip to content
This repository has been archived by the owner on Jul 3, 2020. It is now read-only.

Fix blocks support to Slacker #165

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion slacker/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,10 @@ def post_message(self, channel, text=None, username=None, as_user=None,
if attachments:
if isinstance(attachments, list):
attachments = json.dumps(attachments)

# Ensure blocks are json encoded
if blocks:
if isinstance(blocks, list):
blocks = json.dumps(blocks)
return self.post('chat.postMessage',
data={
'channel': channel,
Expand Down Expand Up @@ -532,6 +535,9 @@ def update(self, channel, ts, text, attachments=None, parse=None,
# Ensure attachments are json encoded
if attachments is not None and isinstance(attachments, list):
attachments = json.dumps(attachments)
# Ensure blocks are json encoded
if blocks is not None and isinstance(blocks, list):
blocks = json.dumps(blocks)
return self.post('chat.update',
data={
'channel': channel,
Expand All @@ -558,6 +564,9 @@ def post_ephemeral(self, channel, text, user, as_user=None,
# Ensure attachments are json encoded
if attachments is not None and isinstance(attachments, list):
attachments = json.dumps(attachments)
# Ensure blocks are json encoded
if blocks is not None and isinstance(blocks, list):
blocks = json.dumps(blocks)
return self.post('chat.postEphemeral',
data={
'channel': channel,
Expand Down