aboutsummaryrefslogtreecommitdiffstats
path: root/wee_slack.py
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2020-03-26 22:59:23 +0100
committerTrygve Aaberge <trygveaa@gmail.com>2020-04-05 20:22:46 +0200
commita037db8cfe9d21d6faf68491c09f293d49902fc5 (patch)
tree7d56b0d37a9c12147090843eb125f7d8cc757906 /wee_slack.py
parent37f1f7be4b7a10847b0bf0d68875067096a883e5 (diff)
downloadwee-slack-a037db8cfe9d21d6faf68491c09f293d49902fc5.tar.gz
Include footer in attachments
Diffstat (limited to 'wee_slack.py')
-rw-r--r--wee_slack.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/wee_slack.py b/wee_slack.py
index a230b3b..6e129d4 100644
--- a/wee_slack.py
+++ b/wee_slack.py
@@ -3484,6 +3484,20 @@ def unwrap_attachments(message_json, text_before):
t.append('%s %s' % (f['title'], f['value'],))
else:
t.append(f['value'])
+
+ footer = attachment.get("footer")
+ if footer:
+ ts = attachment.get("ts")
+ if ts:
+ ts_int = ts if type(ts) == int else SlackTS(ts).major
+ time_string = ''
+ if date.today() - date.fromtimestamp(ts_int) <= timedelta(days=1):
+ time_string = ' at {time}'
+ timestamp_formatted = resolve_ref('!date^{}^{{date_short_pretty}}{}'
+ .format(ts_int, time_string)).capitalize()
+ footer += ' | {}'.format(timestamp_formatted)
+ t.append(footer)
+
fallback = attachment.get("fallback")
if t == [] and fallback and not link_shown:
t.append(fallback)