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
this will toot once every three hours after until it crashes
maybe the code won't be total jenk eventually but \shrug
cron is an okay choice to make it toot regularly

16
gen.py
View file

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