fix nerfnow
This commit is contained in:
parent
506cb6b00f
commit
ebf0d1ef92
@ -3,6 +3,7 @@ from datetime import datetime
|
||||
|
||||
import feedparser
|
||||
from telebot import TeleBot
|
||||
from telegram.constants import MAX_CAPTION_LENGTH
|
||||
|
||||
from feeds.models import FeedModuleConfig
|
||||
|
||||
@ -27,5 +28,9 @@ class NerfNowFeedModuleConfig(FeedModuleConfig):
|
||||
comment = CAPTION_NEWLINE_RE.sub('\n', CAPTION_RE.search(data).group(1))
|
||||
comment = comment.replace('<br />', '')
|
||||
caption = '<b>{}</b>\n\n{}\n\n{}'.format(e['title'], comment, e['feedburner_origlink'])
|
||||
if len(caption) <= MAX_CAPTION_LENGTH:
|
||||
bot.send_photo(chat_id, url, caption, parse_mode='html')
|
||||
else:
|
||||
m = bot.send_photo(chat_id, url)
|
||||
bot.send_message(caption, parse_mode='html', reply_to_message_id=m.message_id)
|
||||
yield e['feedburner_origlink']
|
||||
|
Loading…
Reference in New Issue
Block a user