mirror of
https://github.com/maubot/rss.git
synced 2025-12-31 07:10:56 -05:00
Add support for encoded content
This commit is contained in:
parent
4d2def1fe7
commit
8a95b2edbc
2 changed files with 5 additions and 2 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue