now we only toot once and let cron schedule

This commit is contained in:
jess 2018-02-20 22:47:35 +01:00
parent 36e673fad9
commit d9dbd654ca
2 changed files with 7 additions and 13 deletions

View file

@ -10,6 +10,4 @@ run `python3 main.py` to login and scrape
run `pyhton3 gen.py` to make a toot run `pyhton3 gen.py` to make a toot
this will toot once every three hours after until it crashes cron is an okay choice to make it toot regularly
maybe the code won't be total jenk eventually but \shrug

16
gen.py
View file

@ -13,13 +13,9 @@ client = Mastodon(
with open("corpus.txt") as fp: with open("corpus.txt") as fp:
model = markovify.NewlineText(fp.read()) model = markovify.NewlineText(fp.read())
print("Running...") print("tooting")
while True: # This is not the best long term fix tbh
print("tooting") sentence = None
# This is not the best long term fix tbh while sentence is None:
sentence = None sentence = model.make_sentence(tries=100000)
while sentence is None: client.toot(sentence.replace(chr(31), "\n"))
sentence = model.make_sentence()
client.toot(sentence.replace(chr(31), "\n"))
print("sleeping")
time.sleep(60*60*3)