From 5309354935d3ddace1f8676d77d55aeea0fda835 Mon Sep 17 00:00:00 2001 From: amy Date: Wed, 6 Nov 2024 10:21:00 +0330 Subject: [PATCH] init --- .gitignore | 2 ++ main.py | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 .gitignore create mode 100644 main.py 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) + + + + +