mirror of
https://github.com/maubot/rss.git
synced 2025-01-27 08:17:16 -05:00
Catch individual message send errors separately
This commit is contained in:
parent
db492640d7
commit
b3e76c338e
12
rss/bot.py
12
rss/bot.py
@ -88,14 +88,20 @@ class RSSBot(Plugin):
|
|||||||
except Exception:
|
except Exception:
|
||||||
self.log.exception("Fatal error while polling feeds")
|
self.log.exception("Fatal error while polling feeds")
|
||||||
|
|
||||||
def _send(self, feed: Feed, entry: Entry, sub: Subscription) -> Awaitable[EventID]:
|
async def _send(self, feed: Feed, entry: Entry, sub: Subscription) -> EventID:
|
||||||
return self.client.send_markdown(sub.room_id, sub.notification_template.safe_substitute({
|
message = sub.notification_template.safe_substitute({
|
||||||
"feed_url": feed.url,
|
"feed_url": feed.url,
|
||||||
"feed_title": feed.title,
|
"feed_title": feed.title,
|
||||||
"feed_subtitle": feed.subtitle,
|
"feed_subtitle": feed.subtitle,
|
||||||
"feed_link": feed.link,
|
"feed_link": feed.link,
|
||||||
**entry._asdict(),
|
**entry._asdict(),
|
||||||
}), msgtype=MessageType.NOTICE if sub.send_notice else MessageType.TEXT, allow_html=True)
|
})
|
||||||
|
msgtype = MessageType.NOTICE if sub.send_notice else MessageType.TEXT
|
||||||
|
try:
|
||||||
|
return await self.client.send_markdown(sub.room_id, message, msgtype=msgtype,
|
||||||
|
allow_html=True)
|
||||||
|
except Exception as e:
|
||||||
|
self.log.warning(f"Failed to send {entry.id} of {feed.id} to {sub.room_id}: {e}")
|
||||||
|
|
||||||
async def _broadcast(self, feed: Feed, entry: Entry, subscriptions: List[Subscription]) -> None:
|
async def _broadcast(self, feed: Feed, entry: Entry, subscriptions: List[Subscription]) -> None:
|
||||||
spam_sleep = self.config["spam_sleep"]
|
spam_sleep = self.config["spam_sleep"]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user