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)
|
await _start_broadcast(captions, files, chats)
|
||||||
else:
|
else:
|
||||||
if getattr(random_post, 'selftext', None):
|
if getattr(random_post, 'selftext', None):
|
||||||
text += '\n'
|
caplength = 4094 - len(client.parse_mode.parse(text)[0])
|
||||||
caplength = 4095 - len(client.parse_mode.parse(text)[0])
|
text += '\n\n'
|
||||||
text += html.escape(random_post.selftext[:caplength])
|
captext = random_post.selftext[:caplength]
|
||||||
|
if len(captext) >= caplength:
|
||||||
|
captext = captext[:-1]
|
||||||
|
captext += '…'
|
||||||
|
text += html.escape(captext)
|
||||||
await _start_broadcast([text], None, chats)
|
await _start_broadcast([text], None, chats)
|
||||||
|
|
||||||
def register(pattern):
|
def register(pattern):
|
||||||
|
|
Loading…
Reference in New Issue