Skip to content

Commit

Permalink
formatting slack messages
Browse files Browse the repository at this point in the history
  • Loading branch information
kerrychu committed Jan 23, 2024
1 parent d0a0689 commit 318c3a5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions hooks/slack.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
def send_slack_message(data: dict[str, str], webhook: str) -> str:
text= ""
for key, value in data.items():
if isinstance(value, dict):
for subkey, subvalue in value.items():
text += f"\t⦿ {subkey}: {subvalue}\n"
if isinstance(value, list):
for element in value:
for subkey, subvalue in element.items():
text += f"\t⦿ {subkey}: {subvalue}\n"
text += f"⦿ {key}: {value}\n"

payload = {"text": text}
Expand Down

0 comments on commit 318c3a5

Please sign in to comment.