diff --git a/assets/pictures/meme/not_published/cat_spray.jpg b/assets/pictures/meme/published/cat_spray.jpg similarity index 100% rename from assets/pictures/meme/not_published/cat_spray.jpg rename to assets/pictures/meme/published/cat_spray.jpg diff --git a/assets/pictures/meme/not_published/e3fbbdda01292e42.jpg b/assets/pictures/meme/published/e3fbbdda01292e42.jpg similarity index 100% rename from assets/pictures/meme/not_published/e3fbbdda01292e42.jpg rename to assets/pictures/meme/published/e3fbbdda01292e42.jpg diff --git a/assets/pictures/meme/not_published/f433bb1e9e3bcf1c.png b/assets/pictures/meme/published/f433bb1e9e3bcf1c.png similarity index 100% rename from assets/pictures/meme/not_published/f433bb1e9e3bcf1c.png rename to assets/pictures/meme/published/f433bb1e9e3bcf1c.png diff --git a/helpers/meme_poster_random.js b/helpers/meme_poster_random.js index b2b8c9d..d088a0f 100644 --- a/helpers/meme_poster_random.js +++ b/helpers/meme_poster_random.js @@ -4,12 +4,12 @@ import {getRandomElementOfArray, listFilesOfFolder} from './utils.js' import Masto from "mastodon"; const __dirname = path.resolve(); -const folderMemeUnpublished = 'assets/pictures/meme/not_published' +const folderMemeUnpublished = 'assets/pictures/meme/not_published/' +const folderMemePublished = 'assets/pictures/meme/published/' const list_unpublished_images = listFilesOfFolder(folderMemeUnpublished) -const reallySendPost = false; - -// const reallySendPost = true; +// const reallySendPost = false; +const reallySendPost = true; function postLink() { @@ -57,6 +57,7 @@ function postLink() { // console.log('rep', rep) console.log(`posté avec une nouvelle image, ${configPost.image} WOOT`) console.log("post has been sent, time to move image from unpublished folder: ", selectedImage) + moveImageToPublishedFolder(selectedImage) }, err => { console.error(err) console.log("erreur T_T") @@ -67,4 +68,11 @@ function postLink() { } } +/** + * move to published + * @param imageName + */ +function moveImageToPublishedFolder(imageName){ + return fs.renameSync(folderMemeUnpublished + imageName, folderMemePublished + imageName) +} postLink(); \ No newline at end of file