I use feedreader with my Telegram bot to deliver RSS updates. Currently, each RSS item sends two messages (summary and link). How can I combine them?
if message == '/update':
for idx in range(3):
full_text = rss_feed.entries[idx].description + ' | ' + rss_feed.entries[idx].url
dispatch_message(full_text)
In my experience, combining the summary and URL into one message is a simple yet effective solution. I recently implemented a similar approach where I ensured the structure was consistent and added error handling to account for potential missing fields in the feed entries. This was particularly useful to avoid runtime errors and maintain message clarity. Refining the message format further helped in providing users with a seamless update experience. It is advisable to test with different RSS feeds to guarantee that formatting remains intact across various source implementations.
hey, you can just string concat the two parts into one msg. i did it by appending the url to the summary in one print. make sure you check for missing values so you dont get errors. works pretty smooth for me.
In my view, while it’s straightforward to concatenate the summary and URL, you can further improve your implementation by incorporating string formatting to enhance readability and maintainability. I once encountered a situation where the RSS feed occasionally missed a URL, and using formatted strings allowed me to easily insert fallback values. I also recommend creating a small helper function to manage the message construction, which can help isolate potential issues and simplify unit testing. This approach not only cleans up your main loop but also makes future modifications more manageable in the long run.