ljfbot/ljfbot.py

33 lines
787 B
Python
Raw Permalink Normal View History

#!/usr/bin/env python
2022-11-23 00:55:53 -08:00
import random
from conjugate import conjugate
2022-11-23 00:55:53 -08:00
from mastodon import Mastodon
2023-01-11 16:19:04 -08:00
import json5 as json
2022-11-23 00:55:53 -08:00
2023-01-11 16:19:04 -08:00
with open('config.json') as f:
config = json.load(f)
2022-11-23 00:55:53 -08:00
mastodon = Mastodon(
2023-01-11 16:19:04 -08:00
access_token=config['access_token'],
api_base_url=config['site'],
2022-11-23 00:55:53 -08:00
)
with open('adjectives.txt') as f:
adjectives = list(map(str.rstrip, f))
with open('verbs.txt') as f:
verbs = list(map(str.rstrip, f))
postform = random.choice((
'{adjective} {gender} who {verb}',
'{adjective} {gender}',
'{gender} who {verb}',
))
2023-01-11 16:19:04 -08:00
gender = random.choice(('lgf', 'lbf', 'lef'))
verb = conjugate(random.choice(verbs))
2022-11-23 00:55:53 -08:00
adjective = random.choice(adjectives)
content = postform.format(adjective=adjective, gender=gender, verb=verb)
2022-11-23 00:55:53 -08:00
print(content)
mastodon.status_post(content, visibility='unlisted')