Browse Source

Turns out, captions can only be 1024 characters long

master
blank X 2 years ago
parent
commit
966e5ec799
  1. 4
      redditbot.py

4
redditbot.py

@ -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:

Loading…
Cancel
Save