1
0
Fork 0
mirror of https://gitlab.com/oloturia/fumcaso.git synced 2025-01-09 15:07:19 +01:00

Fixed mastodon bot

This commit is contained in:
oloturia 2019-09-23 15:33:03 +02:00
parent 5e713bd3bd
commit 453caed72f
5 changed files with 8 additions and 28 deletions

Binary file not shown.

Binary file not shown.

34
mastodon_main.py Normal file → Executable file
View file

@ -3,38 +3,18 @@ from randstrip import createStrip
from mastodon import Mastodon from mastodon import Mastodon
import os.path import os.path
API_URL = "https://botsin.space"
if __name__ == "__main__": if __name__ == "__main__":
with open("createapp") as f: with open("createapp") as f:
createapp = f.readlines() createapp = f.readlines()
createapp = [x.strip() for x in createapp] createapp = [x.strip() for x in createapp]
app = createapp[0] TOKEN = createapp[0]
api_base_url_cr = createapp[1] mastodon = Mastodon(access_token = TOKEN,api_base_url = API_URL)
to_file_cr = createapp[2]
email = createapp[3]
pw = createapp[4]
if os.path.exists(content[2]) == False:
Mastodon.create_app(
app,
api_base_url = api_base_url_cr,
to_file = to_file_cr
)
mastodon = Mastodon(
client_id = to_file_cr,
api_base_url = api_base_url_cr
)
mastodon.log_in(
email,
pw,
to_file = to_file_cr
)
mastodon = Mastodon(
access_token = to_file_cr
api_base_url = api_base_url_cr
)
status = createStrip("mastodon.png") status = createStrip("mastodon.png")
if status == 0: if status == 0:
mastodon.media_post("mastodon.png","image/png") new_strip = mastodon.media_post("mastodon.png","image/png")
mastodon.status_post("Nuova striscia",media_ids=new_strip)
else: else:
print("error creating image\n") print("error creating image\n")
print status print(status)

BIN
prova.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 703 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 615 KiB