fixes
This commit is contained in:
parent
662a3d6744
commit
506cb6b00f
@ -108,7 +108,7 @@ class ChannelHelperBotModuleConfig(TelegramBotModuleConfig):
|
|||||||
i.type = 'venue'
|
i.type = 'venue'
|
||||||
i.args = json.dumps([v.location.latitude, v.location.longitude, v.title, v.address, v.foursquare_id])
|
i.args = json.dumps([v.location.latitude, v.location.longitude, v.title, v.address, v.foursquare_id])
|
||||||
elif hasattr(m, 'text') and m.text:
|
elif hasattr(m, 'text') and m.text:
|
||||||
i.type = 'text'
|
i.type = 'message'
|
||||||
i.args = json.dumps([m.text_html, 'html'])
|
i.args = json.dumps([m.text_html, 'html'])
|
||||||
|
|
||||||
if self.queued:
|
if self.queued:
|
||||||
|
@ -18,16 +18,14 @@ class NerfNowFeedModuleConfig(FeedModuleConfig):
|
|||||||
def execute(self, bot: TeleBot, chat_id, last_id):
|
def execute(self, bot: TeleBot, chat_id, last_id):
|
||||||
if last_id is None:
|
if last_id is None:
|
||||||
last_id = ''
|
last_id = ''
|
||||||
if isinstance(last_id, datetime):
|
|
||||||
last_id = last_id.isoformat()
|
|
||||||
|
|
||||||
feed = feedparser.parse('http://feeds.feedburner.com/nerfnow/full')
|
feed = feedparser.parse('http://feeds.feedburner.com/nerfnow/full')
|
||||||
for e in reversed(feed['entries']):
|
for e in reversed(feed['entries']):
|
||||||
if e['updated'] > last_id:
|
if e['feedburner_origlink'] > last_id:
|
||||||
data = e['content'][0]['value'].replace('\n', '')
|
data = e['content'][0]['value'].replace('\n', '')
|
||||||
url = IMAGE_RE.search(data).group(1).replace('/large', '')
|
url = IMAGE_RE.search(data).group(1).replace('/large', '')
|
||||||
comment = CAPTION_NEWLINE_RE.sub('\n', CAPTION_RE.search(data).group(1))
|
comment = CAPTION_NEWLINE_RE.sub('\n', CAPTION_RE.search(data).group(1))
|
||||||
comment = comment.replace('<br />', '')
|
comment = comment.replace('<br />', '')
|
||||||
caption = '<b>{}</b>\n\n{}\n\n{}'.format(e['title'], comment, e['feedburner_origlink'])
|
caption = '<b>{}</b>\n\n{}\n\n{}'.format(e['title'], comment, e['feedburner_origlink'])
|
||||||
bot.send_photo(chat_id, url, caption, parse_mode='html')
|
bot.send_photo(chat_id, url, caption, parse_mode='html')
|
||||||
yield e['updated']
|
yield e['feedburner_origlink']
|
||||||
|
Loading…
Reference in New Issue
Block a user