bot: Some fixes to get SecureScuttlebuttFeed running.

This commit is contained in:
Cory McWilliams 2024-11-09 09:24:13 -05:00
parent 57257f63dd
commit 73cc39226d
2 changed files with 5 additions and 4 deletions

View File

@ -346,8 +346,8 @@ static int _tf_command_publish(const char* file, int argc, char* argv[])
{ {
tf_printf("\n%s publish [options]\n\n", file); tf_printf("\n%s publish [options]\n\n", file);
tf_printf("options:\n"); tf_printf("options:\n");
tf_printf(" -y, --user user User owning identity with which to publish.\n"); tf_printf(" -u, --user user User owning identity with which to publish.\n");
tf_printf(" -i, --identity identity Identity with which to publish message.\n"); tf_printf(" -i, --id identity Identity with which to publish message.\n");
tf_printf(" -d, --db-path db_path SQLite database path (default: %s).\n", k_db_path_default); tf_printf(" -d, --db-path db_path SQLite database path (default: %s).\n", k_db_path_default);
tf_printf(" -c, --content json JSON content of message to publish.\n"); tf_printf(" -c, --content json JSON content of message to publish.\n");
tf_printf(" -h, --help Show this usage information.\n"); tf_printf(" -h, --help Show this usage information.\n");

View File

@ -3,6 +3,7 @@
import argparse import argparse
import feedparser import feedparser
import json import json
import subprocess
import time import time
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
@ -47,9 +48,9 @@ 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 if entry[0] > cutoff])
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': []})
subprocess.check_call(['out/debug/tildefriends', 'publish', '--user', 'cory', '--id', '@DnYDqFfmxdNkYQlpflF9Wkltk2HIhJ5u1MW5njKPLzM=.ed25519', '--content', content])
with open(args.state_file, 'w') as f: with open(args.state_file, 'w') as f:
json.dump(state, 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: else:
print(text) print(text)