38 lines
721 B
Python
38 lines
721 B
Python
|
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)
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|