2019-09-23 00:38:07 +02:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
from randstrip import createStrip
|
|
|
|
from mastodon import Mastodon
|
2019-09-25 12:35:05 +02:00
|
|
|
import os
|
2019-09-23 15:33:03 +02:00
|
|
|
|
2019-09-24 13:26:31 +02:00
|
|
|
fileDir = os.path.dirname(os.path.abspath(__file__))
|
|
|
|
fileDir = fileDir +"/"
|
2019-09-23 15:33:03 +02:00
|
|
|
API_URL = "https://botsin.space"
|
|
|
|
|
2019-09-23 00:38:07 +02:00
|
|
|
if __name__ == "__main__":
|
2019-09-24 13:26:31 +02:00
|
|
|
with open(fileDir+"createapp") as f:
|
2019-09-23 00:38:07 +02:00
|
|
|
createapp = f.readlines()
|
|
|
|
createapp = [x.strip() for x in createapp]
|
2019-09-23 15:33:03 +02:00
|
|
|
TOKEN = createapp[0]
|
|
|
|
mastodon = Mastodon(access_token = TOKEN,api_base_url = API_URL)
|
2019-09-25 12:35:05 +02:00
|
|
|
status = createStrip("mastodon.png")
|
2019-09-23 00:38:07 +02:00
|
|
|
if status == 0:
|
2019-09-24 13:26:31 +02:00
|
|
|
new_strip = mastodon.media_post(fileDir+"mastodon.png","image/png")
|
2019-09-23 15:33:03 +02:00
|
|
|
mastodon.status_post("Nuova striscia",media_ids=new_strip)
|
2019-09-23 00:38:07 +02:00
|
|
|
else:
|
|
|
|
print("error creating image\n")
|
2019-09-23 15:33:03 +02:00
|
|
|
print(status)
|