]> git.mxchange.org Git - fba.git/commitdiff
Preventing the bot from being a hellthread cannon
authorMint <>
Thu, 16 Mar 2023 16:05:15 +0000 (19:05 +0300)
committerMint <>
Thu, 16 Mar 2023 16:05:58 +0000 (19:05 +0300)
fetch_blocks.py

index 614c17ea6caa16f6de7fa00c1b92c1eb554ebf5d..ad1699758dc12dfa12ebd5a9601c4f03ca67d0e6 100644 (file)
@@ -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)"