This commit is contained in:
amy 2024-11-06 10:21:00 +03:30
commit 5309354935
No known key found for this signature in database
2 changed files with 39 additions and 0 deletions

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
notes.txt
config.json

37
main.py Normal file
View file

@ -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)