working meme post and move file

This commit is contained in:
Tykayn 2022-08-08 23:05:23 +02:00 committed by tykayn
parent e936dcc528
commit 9e4c707112
4 changed files with 12 additions and 4 deletions

View File

Before

Width:  |  Height:  |  Size: 52 KiB

After

Width:  |  Height:  |  Size: 52 KiB

View File

Before

Width:  |  Height:  |  Size: 178 KiB

After

Width:  |  Height:  |  Size: 178 KiB

View File

Before

Width:  |  Height:  |  Size: 298 KiB

After

Width:  |  Height:  |  Size: 298 KiB

View File

@ -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();