bot: Split the response for long messages
All checks were successful
Build Docker / Build Docker (push) Successful in 17s

This commit is contained in:
Nathan Woodburn 2023-09-27 17:54:13 +10:00
parent d1daee5d02
commit 0fb5834eb3
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1

12
bot.py
View File

@ -208,7 +208,19 @@ async def ssl(ctx, domain: str):
if not tlsa_records:
message = message + "\n## TLSA Record not found\n"
# 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}")