Make capping sexier

This commit is contained in:
blank X 2020-09-04 16:13:20 +07:00
parent c482c1d857
commit b3ee8bcece
1 changed files with 7 additions and 3 deletions

View File

@ -252,9 +252,13 @@ async def main():
await _start_broadcast(captions, files, chats)
else:
if getattr(random_post, 'selftext', None):
text += '\n'
caplength = 4095 - len(client.parse_mode.parse(text)[0])
text += html.escape(random_post.selftext[:caplength])
caplength = 4094 - len(client.parse_mode.parse(text)[0])
text += '\n\n'
captext = random_post.selftext[:caplength]
if len(captext) >= caplength:
captext = captext[:-1]
captext += ''
text += html.escape(captext)
await _start_broadcast([text], None, chats)
def register(pattern):