1
0
Fork 0
mirror of https://gitlab.com/oloturia/fumcaso.git synced 2025-01-09 15:07:19 +01:00
This commit is contained in:
oloturia 2019-09-25 12:35:05 +02:00
parent 6b4dc1b54c
commit b8df46d284
3 changed files with 4 additions and 4 deletions

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
from randstrip import createStrip from randstrip import createStrip
from mastodon import Mastodon from mastodon import Mastodon
impor os import os
fileDir = os.path.dirname(os.path.abspath(__file__)) fileDir = os.path.dirname(os.path.abspath(__file__))
fileDir = fileDir +"/" fileDir = fileDir +"/"
@ -13,7 +13,7 @@ if __name__ == "__main__":
createapp = [x.strip() for x in createapp] createapp = [x.strip() for x in createapp]
TOKEN = createapp[0] TOKEN = createapp[0]
mastodon = Mastodon(access_token = TOKEN,api_base_url = API_URL) mastodon = Mastodon(access_token = TOKEN,api_base_url = API_URL)
status = createStrip(fileDir+"mastodon.png") status = createStrip("mastodon.png")
if status == 0: if status == 0:
new_strip = mastodon.media_post(fileDir+"mastodon.png","image/png") new_strip = mastodon.media_post(fileDir+"mastodon.png","image/png")
mastodon.status_post("Nuova striscia",media_ids=new_strip) mastodon.status_post("Nuova striscia",media_ids=new_strip)

View file

@ -134,7 +134,7 @@ def createStrip(name):
try: try:
story = fetchVign() story = fetchVign()
finalStrip = writeStrip(story) finalStrip = writeStrip(story)
finalStrip.save(name) finalStrip.save(fileDir+name)
return 0 return 0
except Exception as err: except Exception as err:
return err return err

View file

@ -8,7 +8,7 @@ fileDir = os.path.dirname(os.path.abspath(__file__))
fileDir = fileDir +"/" fileDir = fileDir +"/"
def newStrip(bot, update): def newStrip(bot, update):
status = createStrip(fileDir+"telegram.png") status = createStrip("telegram.png")
if status == 0: if status == 0:
try: try:
bot.send_photo(chat_id=update.message.chat_id,photo=open(fileDir+"telegram.png","rb")) bot.send_photo(chat_id=update.message.chat_id,photo=open(fileDir+"telegram.png","rb"))