init
This commit is contained in:
commit
5309354935
2 changed files with 39 additions and 0 deletions
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
notes.txt
|
||||
config.json
|
37
main.py
Normal file
37
main.py
Normal 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)
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in a new issue