fix it yes

This commit is contained in:
Tomáš Mládek 2018-02-06 19:42:51 +01:00
parent 669ec2aad1
commit 231faf0cd5

View file

@ -87,10 +87,13 @@ def download_raw(url, filename, subdir, date):
def get_first_hashtag(message):
hashtags = list(filter(lambda e: e.type == 'hashtag', list(message.entities + message.caption_entities)))
hashtags = list(map(message.parse_entity,
list(filter(lambda e: e.type == 'hashtag', message.entities))))
hashtags += list(map(message.parse_caption_entity,
list(filter(lambda e: e.type == 'hashtag', message.caption_entities))))
if len(hashtags) == 0:
return None
hashtag = message.parse_entity(hashtags[0])
hashtag = hashtags[0]
return hashtag[1:].upper()