Make default notification template configurable

Closes #29
Fixes #24

Co-authored-by: noantiq <timucin.boldt@udo.edu>
This commit is contained in:
Tulir Asokan 2022-03-26 14:45:07 +02:00
parent 18ef939a04
commit 9a75ee4021
2 changed files with 6 additions and 1 deletions

View File

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

View File

@ -51,6 +51,7 @@ class Config(BaseProxyConfig):
helper.copy("max_backoff")
helper.copy("spam_sleep")
helper.copy("command_prefix")
helper.copy("notification_template")
helper.copy("admins")
@ -360,7 +361,9 @@ class RSSBot(Plugin):
)
await evt.reply(f"{subscriber} had already subscribed this room to {feed_info}")
else:
await self.dbm.subscribe(feed.id, evt.room_id, evt.sender)
await self.dbm.subscribe(
feed.id, evt.room_id, evt.sender, self.config["notification_template"]
)
await evt.reply(f"Subscribed to {feed_info}")
@rss.subcommand(