working meme post and move file
This commit is contained in:
parent
e936dcc528
commit
9e4c707112
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 52 KiB |
Before Width: | Height: | Size: 178 KiB After Width: | Height: | Size: 178 KiB |
Before Width: | Height: | Size: 298 KiB After Width: | Height: | Size: 298 KiB |
@ -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();
|
Loading…
Reference in New Issue
Block a user