2024-02-23 12:05:37 +00:00
|
|
|
|
import chain
|
|
|
|
|
import sys
|
|
|
|
|
import requests
|
|
|
|
|
|
|
|
|
|
import secrets__
|
2024-05-20 22:28:48 +00:00
|
|
|
|
import config__
|
2024-02-23 12:05:37 +00:00
|
|
|
|
|
2024-05-20 22:28:48 +00:00
|
|
|
|
model_f = open(config__.model_file)
|
2024-02-23 12:05:37 +00:00
|
|
|
|
model = chain.Text.from_json(model_f.read())
|
|
|
|
|
|
|
|
|
|
generated = False
|
|
|
|
|
text = None
|
|
|
|
|
|
|
|
|
|
while not generated:
|
2024-05-20 22:28:48 +00:00
|
|
|
|
text = model.make_short_sentence(config__.character_limit, tries=900, min_words=3)
|
2024-02-23 12:05:37 +00:00
|
|
|
|
generated = text is not None
|
|
|
|
|
|
|
|
|
|
text = text.replace('@','@').replace('#','#')
|
|
|
|
|
print(text)
|
|
|
|
|
|
2024-05-20 22:28:48 +00:00
|
|
|
|
apicreate = "https://" + config__.instance_url + "/api/notes/create"\
|
2024-02-23 12:05:37 +00:00
|
|
|
|
|
2024-05-20 22:28:48 +00:00
|
|
|
|
if(config__.cw == ""):
|
|
|
|
|
requests.post(apicreate, json={
|
|
|
|
|
'i': secrets__.TOKEN,
|
2024-02-23 12:05:37 +00:00
|
|
|
|
|
2024-05-20 22:28:48 +00:00
|
|
|
|
'visibility': 'home',
|
|
|
|
|
'noExtractMentions': True,
|
|
|
|
|
'noExtractHashtags': True,
|
|
|
|
|
|
|
|
|
|
'text': text,
|
|
|
|
|
})
|
|
|
|
|
else:
|
|
|
|
|
requests.post(apicreate, json={
|
|
|
|
|
'i': secrets__.TOKEN,
|
|
|
|
|
|
|
|
|
|
'visibility': 'home',
|
|
|
|
|
'noExtractMentions': True,
|
|
|
|
|
'noExtractHashtags': True,
|
|
|
|
|
|
|
|
|
|
'text': text,
|
|
|
|
|
'cw': config__.cw
|
|
|
|
|
})
|