From ae142a380d963246853d5e0ed4996dbebee2f147 Mon Sep 17 00:00:00 2001 From: Daniel Teunis Date: Wed, 7 Jun 2023 19:33:07 +0200 Subject: [PATCH] rss-bot: Allow overriding the topic default. rss-bot selects the topic of its RSS notification messages based on the topic of the RSS feed. Monitoring a large number of RSS feeds therefore leads to a large number of topics in the stream. Also, the user has no option to customize the topic names. This patch adds a new `--topic` argument that replaces the topic for all RSS feed notifications with the provided string. If no custom topic is provided, the bot uses the default behaviour described above. --- zulip/integrations/rss/rss-bot | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/zulip/integrations/rss/rss-bot b/zulip/integrations/rss/rss-bot index fa6c457e..fa9fbb77 100755 --- a/zulip/integrations/rss/rss-bot +++ b/zulip/integrations/rss/rss-bot @@ -58,6 +58,13 @@ parser.add_argument( default="rss", action="store", ) +parser.add_argument( + "--topic", + dest="topic", + help="A fixed topic to use for RSS messages, overriding the default of the feed title/URL", + default=None, + action="store", +) parser.add_argument( "--data-dir", dest="data_dir", @@ -183,7 +190,7 @@ def send_zulip(entry: Any, feed_name: str) -> Dict[str, Any]: message = { "type": "stream", "to": opts.stream, - "subject": elide_subject(feed_name), + "subject": opts.topic or elide_subject(feed_name), "content": content, } # type: Dict[str, str] return client.send_message(message)