Turns out, captions can only be 1024 characters long

This commit is contained in:
blank X 2020-09-04 21:52:30 +07:00
parent 59506a4d48
commit 966e5ec799
1 changed files with 2 additions and 2 deletions

View File

@ -225,7 +225,7 @@ async def main():
desc = i['description']
if desc:
to_append += ': ' + desc.strip()
caplength = 2047 - len(client.parse_mode.parse(text)[0])
caplength = 1023 - len(client.parse_mode.parse(text)[0])
captext = to_append[:caplength]
if len(captext) >= caplength:
captext = captext[:-1]
@ -288,7 +288,7 @@ async def main():
else:
tat = f'<a href="{url}">{zws}</a>{tat}'
if pdesc:
caplength = 2047 if pimg else 4095
caplength = 1023 if pimg else 4095
caplength -= len(client.parse_mode.parse(tat)[0])
captext = pdesc[:caplength]
if len(captext) >= caplength: