From 56d672fef94f5d686280964596138b05cfed14c9 Mon Sep 17 00:00:00 2001 From: Mint <> Date: Thu, 16 Mar 2023 19:05:15 +0300 Subject: [PATCH] Preventing the bot from being a hellthread cannon --- fetch_blocks.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fetch_blocks.py b/fetch_blocks.py index 614c17e..ad16997 100644 --- a/fetch_blocks.py +++ b/fetch_blocks.py @@ -26,7 +26,9 @@ def send_bot_post(instance: str, blocks: dict): if block["reason"] == None or block["reason"] == '': message = message + block["blocked"] + " with unspecified reason\n" else: - message = message + block["blocked"] + ' for "' + block["reason"] + '"\n' + if len(block["reason"]) > 420: + block["reason"] = block["reason"][0:419] + "[…]" + message = message + block["blocked"] + ' for "' + block["reason"].replace("@", "@\u200b") + '"\n' if truncated: message = message + "(the list has been truncated to the first 20 entries)" -- 2.39.5