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
16
bot.py
16
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
|
||||
|
Loading…
Reference in New Issue
Block a user