diff --git a/rss/bot.py b/rss/bot.py index 0352f4c..6c6e2fc 100644 --- a/rss/bot.py +++ b/rss/bot.py @@ -21,6 +21,7 @@ from time import mktime, time import asyncio import hashlib +import html import aiohttp import attr @@ -392,7 +393,7 @@ async def unsubscribe(self, evt: MessageEvent, feed_id: int) -> None: help="Change the notification template for a subscription in this room", ) @command.argument("feed_id", "feed ID", parser=int) - @command.argument("template", "new template", pass_raw=True) + @command.argument("template", "new template", pass_raw=True, required=False) async def command_template(self, evt: MessageEvent, feed_id: int, template: str) -> None: if not await self.can_manage(evt): return @@ -400,6 +401,13 @@ async def command_template(self, evt: MessageEvent, feed_id: int, template: str) if not sub: await evt.reply("This room is not subscribed to that feed") return + if not template: + await evt.reply( + '

Current template in this room:

'
+                f"{html.escape(sub.notification_template.template)}"
+                "
", allow_html=True, markdown=False, + ) + return await self.dbm.update_template(feed.id, evt.room_id, template) sub = Subscription( feed_id=feed.id,