From 506cb6b00fb8aa5a4268d69da455458907cd2f7a Mon Sep 17 00:00:00 2001 From: bakatrouble Date: Wed, 4 Dec 2019 18:38:14 +0300 Subject: [PATCH] fixes --- bots/modules/channel_helper.py | 2 +- feeds/modules/nerfnow.py | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/bots/modules/channel_helper.py b/bots/modules/channel_helper.py index 26e8e4a..96a01dc 100644 --- a/bots/modules/channel_helper.py +++ b/bots/modules/channel_helper.py @@ -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: diff --git a/feeds/modules/nerfnow.py b/feeds/modules/nerfnow.py index aca1aad..da53792 100644 --- a/feeds/modules/nerfnow.py +++ b/feeds/modules/nerfnow.py @@ -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('
', '') caption = '{}\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']