From 57257f63dd491f2a2eb31ec7bb0a671174e709a1 Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Sat, 9 Nov 2024 09:01:34 -0500 Subject: [PATCH] bot: Add a little script to post about recent development activity from a handful of RSS feeds I've gathered. --- tools/buttfeed.py | 55 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100755 tools/buttfeed.py diff --git a/tools/buttfeed.py b/tools/buttfeed.py new file mode 100755 index 00000000..be14d5cf --- /dev/null +++ b/tools/buttfeed.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python3 + +import argparse +import feedparser +import json +import time + +parser = argparse.ArgumentParser() +parser.add_argument('--state_file', help = 'Path to a file in which to store state.') +args = parser.parse_args() + +k_feeds = { + 'tildefriends': 'https://dev.tildefriends.net/cory/tildefriends.rss', + 'erlbutt': 'https://github.com/cmoid/erlbutt/commits/main.atom', + 'habitat': 'https://gitlab.com/quickdudley/habitat/-/commits/main.atom', + 'habitat': 'https://gitlab.com/quickdudley/habitat/-/commits/internet.atom', + 'manyverse': 'https://gitlab.com/staltz/manyverse/-/commits/master?format=atom', + 'ahau': 'https://gitlab.com/ahau/ahau/-/commits/master.atom', +} + +def fix_title(entry): + if entry.summary.startswith(' cutoff]) + state['last_update'] = entries[0][0] + if args.state_file: + with open(args.state_file, 'w') as f: + json.dump(state, f) + content = json.dumps({'type': 'post', 'text': text, 'mentions': []}) + subprocess.check_call(['out/debug/tildefriends', 'publish', '--user', 'cory', '--identity', '@DnYDqFfmxdNkYQlpflF9Wkltk2HIhJ5u1MW5njKPLzM=.ed25519', '--content', content]) + else: + print(text)