From 029c28fd8bbd8eb7f1ce480d8faf2e13cdaeaccd Mon Sep 17 00:00:00 2001 From: Marek Isalski Date: Sun, 5 Sep 2021 13:02:45 +0100 Subject: [PATCH] shorten messages --- fih.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fih.py b/fih.py index eecdfe3..80e857d 100644 --- a/fih.py +++ b/fih.py @@ -88,8 +88,11 @@ def mattermost_incident_command( command, args, channel_id, raw_incident_number, ev.set_year( datetime.datetime.utcnow().strftime( "%Y" ) ) written = ev.write() + short_written = written + if len( short_written ) > 512: + short_written = short_written[ :509 ] + "..." app.mm.posts.create_post( options = { 'channel_id': private_channel_id, - 'message': "#### Written `%s`:\n\n```\n%s```" % ( ev.path_short(), written ), + 'message': "#### Written `%s`:\n\n```\n%s```" % ( ev.path_short(), short_written ), } ) cmdline = app.config[ "MERCURIAL_BIN" ] + " add " + ev.path_short()