Add support for encoded content

This commit is contained in:
A git user 2023-08-15 15:29:45 +02:00
parent 4d2def1fe7
commit 8a95b2edbc
No known key found for this signature in database
GPG key ID: 7920D03B7AA7CD7B
2 changed files with 5 additions and 2 deletions

View file

@ -296,6 +296,7 @@ class RSSBot(Plugin):
title=getattr(entry, "title", ""),
summary=getattr(entry, "description", "").strip(),
link=getattr(entry, "link", ""),
content_encoded=entry["content"][0]["value"].strip(),
)
@staticmethod
@ -419,6 +420,7 @@ class RSSBot(Plugin):
user_id=sub.user_id,
notification_template=Template(template),
send_notice=sub.send_notice,
send_encoded=sub.send_encoded,
)
sample_entry = Entry(
feed_id=feed.id,
@ -427,6 +429,7 @@ class RSSBot(Plugin):
title="Sample entry",
summary="This is a sample entry to demonstrate your new template",
link="http://example.com",
content_encoded="<b>Sample encoded content</b>"
)
await evt.reply(f"Template for feed ID {feed.id} updated. Sample notification:")
await self._send(feed, sample_entry, sub)

View file

@ -166,7 +166,7 @@ class DBManager:
else:
q = (
"INSERT INTO entry (feed_id, id, date, title, summary, link, content_encoded) "
"VALUES ($1, $2, $3, $4, $5, $6)"
"VALUES ($1, $2, $3, $4, $5, $6, $7)"
)
await conn.executemany(q, records)
@ -232,7 +232,7 @@ class DBManager:
INSERT INTO subscription (
feed_id, room_id, user_id, notification_template,
send_notice, send_encoded)
VALUES ($1, $2, $3, $4, $5)
VALUES ($1, $2, $3, $4, $5, $6)
"""
template = template or "New post in $feed_title: [$title]($link)"
await self.db.execute(