bot: Split the response for long messages
All checks were successful
Build Docker / Build Docker (push) Successful in 17s
All checks were successful
Build Docker / Build Docker (push) Successful in 17s
This commit is contained in:
parent
d1daee5d02
commit
0fb5834eb3
12
bot.py
12
bot.py
@ -208,7 +208,19 @@ async def ssl(ctx, domain: str):
|
|||||||
if not tlsa_records:
|
if not tlsa_records:
|
||||||
message = message + "\n## TLSA Record not found\n"
|
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)
|
await ctx.response.send_message(message)
|
||||||
else:
|
else:
|
||||||
ctx.response.send_message(f"No certificate found for {domain}")
|
ctx.response.send_message(f"No certificate found for {domain}")
|
||||||
|
Loading…
Reference in New Issue
Block a user