ljfbot/ljfbot.py

33 lines
787 B
Python
Executable File

#!/usr/bin/env python
import random
from conjugate import conjugate
from mastodon import Mastodon
import json5 as json
with open('config.json') as f:
config = json.load(f)
mastodon = Mastodon(
access_token=config['access_token'],
api_base_url=config['site'],
)
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}',
))
gender = random.choice(('lgf', 'lbf', 'lef'))
verb = conjugate(random.choice(verbs))
adjective = random.choice(adjectives)
content = postform.format(adjective=adjective, gender=gender, verb=verb)
print(content)
mastodon.status_post(content, visibility='unlisted')