def convert_to_embed(entry):
first_ligne = first_ligne_regex.search(entry.summary).group(0)
fl_without_tags = tag_regex.subn('', first_ligne)[0]
description = html.unescape(fl_without_tags)
colour = discord.Colour.magenta()
timestamp = datetime.fromtimestamp(mktime(entry.published_parsed))
embed = discord.Embed(title=entry.title, description=description, url=entry.link, colour=colour, timestamp=timestamp)
image = first_img_regex.search(entry.summary)
if image:
image_url = img_src_url_regex.search(image.group(0)).group(0)
embed.set_image(url=image_url)
embed.set_author(name=_(krosfeed["name"]), url=_(krosfeed["url"]), icon_url=krosfeed["icon"])
return embed
# Get the new entries that have not yet been parsed
# Parameters:
# - feed: dict, the feed containing the entries
# - entry_id: str, the id of the last entry that have been parsed
# Return:
# - last_entries: list, discord embeds presenting the data of each not parsed entry
评论列表
文章目录