Make capping sexier
This commit is contained in:
parent
c482c1d857
commit
b3ee8bcece
10
redditbot.py
10
redditbot.py
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue