move image after posting
This commit is contained in:
parent
9ecf691d05
commit
dc14b25a94
6
bot.py
6
bot.py
|
@ -10,7 +10,8 @@ import config
|
|||
import auth
|
||||
|
||||
# choose a random image
|
||||
randomImage = config.picturePath + random.choice(os.listdir(config.picturePath))
|
||||
randomImageChoice = random.choice(os.listdir(config.picturePath))
|
||||
randomImage = config.picturePath + randomImageChoice
|
||||
|
||||
# connect to the mastodon api
|
||||
mastodon = Mastodon(
|
||||
|
@ -28,6 +29,9 @@ media = mastodon.media_post(randomImage, None, config.desc)
|
|||
# post image as status
|
||||
tootSent = mastodon.status_post(config.status, media_ids=media)
|
||||
|
||||
# clean up and make sure image not used again
|
||||
os.rename(randomImage, config.usedPicturePath+randomImageChoice)
|
||||
|
||||
print('Sent!')
|
||||
print(tootSent['url'])
|
||||
|
||||
|
|
Loading…
Reference in New Issue