|
|
|
@ -15,7 +15,7 @@ tokenHandler.getAccessToken((accessToken) => {
|
|
|
|
|
access_token: accessToken,
|
|
|
|
|
});
|
|
|
|
|
let memeHandler = new MemeHandler(memeAPI, subreddits, allowedMedia);
|
|
|
|
|
executeAndSetInterval(() => {
|
|
|
|
|
executeAndSetInterval(function postRandomMeme(){
|
|
|
|
|
memeHandler.getRandomMeme(sub => {
|
|
|
|
|
let status = `"${sub.title}"\n${sub.text}\nby ${sub.author}`;
|
|
|
|
|
if (allowedMedia.find(type => type === sub.url.split(/[.]+/).pop())){
|
|
|
|
@ -24,7 +24,8 @@ tokenHandler.getAccessToken((accessToken) => {
|
|
|
|
|
client.postMedia(status, filepath);
|
|
|
|
|
})
|
|
|
|
|
}else{
|
|
|
|
|
client.postStatus(status);
|
|
|
|
|
console.log("no valid media, fetching new sub")
|
|
|
|
|
postRandomMeme();
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}, interval);
|
|
|
|
|