Skip to content

Commit 9a75ee4

Browse files
tulirnoantiq
andcommitted
Make default notification template configurable
Closes #29 Fixes #24 Co-authored-by: noantiq <[email protected]>
1 parent 18ef939 commit 9a75ee4

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

base-config.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ spam_sleep: 2
88
# The prefix for all commands
99
# It has to be prefixed with ! in matrix to be recognised
1010
command_prefix: "rss"
11+
# Default post notification template for new subscriptions
12+
notification_template: "New post in $feed_title: [$title]($link)"
1113
# Users who can bypass room permission checks
1214
admins:
1315
- "@user:example.com"

rss/bot.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ def do_update(self, helper: ConfigUpdateHelper) -> None:
5151
helper.copy("max_backoff")
5252
helper.copy("spam_sleep")
5353
helper.copy("command_prefix")
54+
helper.copy("notification_template")
5455
helper.copy("admins")
5556

5657

@@ -360,7 +361,9 @@ async def subscribe(self, evt: MessageEvent, url: str) -> None:
360361
)
361362
await evt.reply(f"{subscriber} had already subscribed this room to {feed_info}")
362363
else:
363-
await self.dbm.subscribe(feed.id, evt.room_id, evt.sender)
364+
await self.dbm.subscribe(
365+
feed.id, evt.room_id, evt.sender, self.config["notification_template"]
366+
)
364367
await evt.reply(f"Subscribed to {feed_info}")
365368

366369
@rss.subcommand(

0 commit comments

Comments
 (0)