+def send_bot_post(instance: str, blocks: dict):
+ message = instance + " has blocked the following instances:\n\n"
+ truncated = False
+ if len(blocks) > 20:
+ truncated = True
+ blocks = blocks[0 : 19]
+ for block in blocks:
+ 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 truncated:
+ message = message + "(the list has been truncated to the first 20 entries)"
+
+ botheaders = {**headers, **{"Authorization": "Bearer " + config["bot_token"]}}
+ req = post(f"{config['bot_instance']}/api/v1/statuses",
+ data={"status":message, "visibility":config['bot_visibility'], "content_type":"text/plain"},
+ headers=botheaders, timeout=10).json()
+ print(req)
+ return True