Skip to content

Commit 1a52d18

Browse files
committed
Show current template if ran without arguments
1 parent f12d32a commit 1a52d18

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

rss/bot.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
from time import mktime, time
2222
import asyncio
2323
import hashlib
24+
import html
2425

2526
import aiohttp
2627
import attr
@@ -392,14 +393,21 @@ async def unsubscribe(self, evt: MessageEvent, feed_id: int) -> None:
392393
help="Change the notification template for a subscription in this room",
393394
)
394395
@command.argument("feed_id", "feed ID", parser=int)
395-
@command.argument("template", "new template", pass_raw=True)
396+
@command.argument("template", "new template", pass_raw=True, required=False)
396397
async def command_template(self, evt: MessageEvent, feed_id: int, template: str) -> None:
397398
if not await self.can_manage(evt):
398399
return
399400
sub, feed = await self.dbm.get_subscription(feed_id, evt.room_id)
400401
if not sub:
401402
await evt.reply("This room is not subscribed to that feed")
402403
return
404+
if not template:
405+
await evt.reply(
406+
'<p>Current template in this room:</p><pre><code language="markdown">'
407+
f"{html.escape(sub.notification_template.template)}"
408+
"</code></pre>", allow_html=True, markdown=False,
409+
)
410+
return
403411
await self.dbm.update_template(feed.id, evt.room_id, template)
404412
sub = Subscription(
405413
feed_id=feed.id,

0 commit comments

Comments
 (0)