From 0fb5834eb35a1f42731ffe74d0bc65b2186c4c07 Mon Sep 17 00:00:00 2001 From: Nathan Woodburn Date: Wed, 27 Sep 2023 17:54:13 +1000 Subject: [PATCH] bot: Split the response for long messages --- bot.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/bot.py b/bot.py index 772dd14..41d9c48 100644 --- a/bot.py +++ b/bot.py @@ -208,8 +208,20 @@ async def ssl(ctx, domain: str): if not tlsa_records: message = message + "\n## TLSA Record not found\n" - - await ctx.response.send_message(message) + # If message is too long, send it in 2 messages + if (len(message) > 2000): + # Split on the last line under 2000 characters + message1 = message[:2000] + message1 = message1[:message1.rfind("\n")] + message2 = message[len(message1):] + + + await ctx.response.send_message(message1) + await ctx.send(message2) + + + else: + await ctx.response.send_message(message) else: ctx.response.send_message(f"No certificate found for {domain}") return