bot: Fix empty buttfeed posts, and use requested RSS feed for Habitat.

This commit is contained in:
Cory McWilliams 2024-11-10 19:30:36 -05:00
parent 09ae4e2096
commit 44ebb841f0

View File

@ -13,8 +13,7 @@ args = parser.parse_args()
k_feeds = { k_feeds = {
'tildefriends': 'https://dev.tildefriends.net/cory/tildefriends.rss', 'tildefriends': 'https://dev.tildefriends.net/cory/tildefriends.rss',
'erlbutt': 'https://github.com/cmoid/erlbutt/commits/main.atom', 'erlbutt': 'https://github.com/cmoid/erlbutt/commits/main.atom',
'habitat': 'https://gitlab.com/quickdudley/habitat/-/commits/main.atom', 'habitat': 'https://tildegit.org/jeremylist/habitat.rss',
'habitat': 'https://gitlab.com/quickdudley/habitat/-/commits/internet.atom',
'manyverse': 'https://gitlab.com/staltz/manyverse/-/commits/master?format=atom', 'manyverse': 'https://gitlab.com/staltz/manyverse/-/commits/master?format=atom',
'ahau': 'https://gitlab.com/ahau/ahau/-/commits/master.atom', 'ahau': 'https://gitlab.com/ahau/ahau/-/commits/master.atom',
} }
@ -43,9 +42,9 @@ if args.state_file:
pass pass
cutoff = state.get('last_update') or (time.time() - 2 * 7 * 24 * 60 * 60) cutoff = state.get('last_update') or (time.time() - 2 * 7 * 24 * 60 * 60)
entries = get_entries() entries = [entry for entry in get_entries() if entry[0] > cutoff]
if entries: if entries:
text = '# Recent Secure Scuttlebutt Development Activity\n\n' + '\n'.join([f' * [{entry[1]}] [{entry[3]}]({entry[2]})' for entry in entries if entry[0] > cutoff]) text = '# Recent Secure Scuttlebutt Development Activity\n\n' + '\n'.join([f' * [{entry[1]}] [{entry[3]}]({entry[2]})' for entry in entries])
state['last_update'] = entries[0][0] state['last_update'] = entries[0][0]
if args.state_file: if args.state_file:
content = json.dumps({'type': 'post', 'text': text, 'mentions': []}) content = json.dumps({'type': 'post', 'text': text, 'mentions': []})