mirror of
https://github.com/maubot/rss.git
synced 2024-10-01 08:25:36 -04:00
sort imports w/ isort & format w/ black
Signed-off-by: Sebastian Hoß <seb@xn--ho-hia.de>
This commit is contained in:
parent
4c9a7258e2
commit
541a78d210
14
rss/bot.py
14
rss/bot.py
@ -22,13 +22,12 @@ from time import mktime, time
|
||||
import asyncio
|
||||
import hashlib
|
||||
import html
|
||||
import re
|
||||
|
||||
import aiohttp
|
||||
import attr
|
||||
import feedparser
|
||||
|
||||
import re
|
||||
|
||||
from maubot import MessageEvent, Plugin, __version__ as maubot_version
|
||||
from maubot.handlers import command, event
|
||||
from mautrix.types import (
|
||||
@ -110,7 +109,9 @@ class RSSBot(Plugin):
|
||||
async def _send(self, feed: Feed, entry: Entry, sub: Subscription) -> EventID | None:
|
||||
title_exclude_filter = sub.title_exclude_filter
|
||||
if title_exclude_filter:
|
||||
self.log.debug(f"Feed '{feed.id}' ({feed.title}) has exclude filter '{title_exclude_filter}'")
|
||||
self.log.debug(
|
||||
f"Feed '{feed.id}' ({feed.title}) has exclude filter '{title_exclude_filter}'"
|
||||
)
|
||||
if re.search(title_exclude_filter, entry.title):
|
||||
self.log.info(f"Excluded '{entry.title}'")
|
||||
return None
|
||||
@ -400,7 +401,9 @@ class RSSBot(Plugin):
|
||||
return
|
||||
await self.dbm.update_title_filter(feed.id, evt.room_id, title_exclude_filter)
|
||||
if title_exclude_filter:
|
||||
await evt.reply(f"Feed {feed_id} will now exclude titles matching: {title_exclude_filter}")
|
||||
await evt.reply(
|
||||
f"Feed {feed_id} will now exclude titles matching: {title_exclude_filter}"
|
||||
)
|
||||
else:
|
||||
await evt.reply(f"Removed title exclude filter from feed {feed_id}")
|
||||
|
||||
@ -501,7 +504,8 @@ class RSSBot(Plugin):
|
||||
await evt.reply(
|
||||
"**Subscriptions in this room:**\n\n"
|
||||
+ "\n".join(
|
||||
self._format_subscription(feed, subscriber, title_exclude_filter) for feed, subscriber, title_exclude_filter in subscriptions
|
||||
self._format_subscription(feed, subscriber, title_exclude_filter)
|
||||
for feed, subscriber, title_exclude_filter in subscriptions
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -244,6 +244,8 @@ class DBManager:
|
||||
q = "UPDATE subscription SET send_notice=$3 WHERE feed_id=$1 AND room_id=$2"
|
||||
await self.db.execute(q, feed_id, room_id, send_notice)
|
||||
|
||||
async def update_title_filter(self, feed_id: int, room_id: RoomID, title_exclude_filter: str) -> None:
|
||||
async def update_title_filter(
|
||||
self, feed_id: int, room_id: RoomID, title_exclude_filter: str
|
||||
) -> None:
|
||||
q = "UPDATE subscription SET title_exclude_filter=$3 WHERE feed_id=$1 AND room_id=$2"
|
||||
await self.db.execute(q, feed_id, room_id, title_exclude_filter)
|
||||
|
Loading…
Reference in New Issue
Block a user