This commit is contained in:
bakatrouble 2019-12-04 18:38:14 +03:00
parent 662a3d6744
commit 506cb6b00f
2 changed files with 3 additions and 5 deletions

View File

@ -108,7 +108,7 @@ class ChannelHelperBotModuleConfig(TelegramBotModuleConfig):
i.type = 'venue'
i.args = json.dumps([v.location.latitude, v.location.longitude, v.title, v.address, v.foursquare_id])
elif hasattr(m, 'text') and m.text:
i.type = 'text'
i.type = 'message'
i.args = json.dumps([m.text_html, 'html'])
if self.queued:

View File

@ -18,16 +18,14 @@ class NerfNowFeedModuleConfig(FeedModuleConfig):
def execute(self, bot: TeleBot, chat_id, last_id):
if last_id is None:
last_id = ''
if isinstance(last_id, datetime):
last_id = last_id.isoformat()
feed = feedparser.parse('http://feeds.feedburner.com/nerfnow/full')
for e in reversed(feed['entries']):
if e['updated'] > last_id:
if e['feedburner_origlink'] > last_id:
data = e['content'][0]['value'].replace('\n', '')
url = IMAGE_RE.search(data).group(1).replace('/large', '')
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'])
bot.send_photo(chat_id, url, caption, parse_mode='html')
yield e['updated']
yield e['feedburner_origlink']