commit 5309354935d3ddace1f8676d77d55aeea0fda835 Author: amy Date: Wed Nov 6 10:21:00 2024 +0330 init diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..95463af --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +notes.txt +config.json \ No newline at end of file diff --git a/main.py b/main.py new file mode 100644 index 0000000..fe9b648 --- /dev/null +++ b/main.py @@ -0,0 +1,37 @@ +import markovify +import requests +import schedule +import json +import time + + +with open('config.json', 'r') as f: + data = json.load(f) +MAIN_URL = data["mainurl"] + +with open("notes.txt") as f: + text = f.read() + text_model = markovify.NewlineText(text) + +def sendpost(): + requests.post( + MAIN_URL, + headers={ + "Authorization": "Bearer " + data["misskey_token"] + }, + json={ + "cw":"markov generated post", + "text":text_model.make_short_sentence(200).replace("@", "@ ").replace("\\n", "\n") + } + ) + +schedule.every().day.at("12:00").do(sendpost) + +while True: + schedule.run_pending() + time.sleep(1) + + + + +