|
|
@ -1,6 +1,7 @@
|
|
|
|
import {MastodonHandler} from "./mastodonHandler.js";
|
|
|
|
import {MastodonHandler} from "./mastodonHandler.js";
|
|
|
|
import {MastodonTokenHandler} from "./mastodonTokenHandler.js";
|
|
|
|
import {MastodonTokenHandler} from "./mastodonTokenHandler.js";
|
|
|
|
import {MemeHandler} from "./memeHandler.js";
|
|
|
|
import {MemeHandler} from "./memeHandler.js";
|
|
|
|
|
|
|
|
import {getStat} from "./JSONdataStore";
|
|
|
|
|
|
|
|
|
|
|
|
const baseUrl = "https://social.cybre.town";
|
|
|
|
const baseUrl = "https://social.cybre.town";
|
|
|
|
const memeAPI = "http://redditapi.adb.sh/api/v1/";
|
|
|
|
const memeAPI = "http://redditapi.adb.sh/api/v1/";
|
|
|
@ -20,6 +21,7 @@ await tokenHandler.getAccessToken((accessToken) => {
|
|
|
|
let status = `"${sub.title}"\n${sub.text}\nby ${sub.author}`;
|
|
|
|
let status = `"${sub.title}"\n${sub.text}\nby ${sub.author}`;
|
|
|
|
if (allowedMedia.find(type => type === sub.url.split(/[.]+/).pop())){
|
|
|
|
if (allowedMedia.find(type => type === sub.url.split(/[.]+/).pop())){
|
|
|
|
let filepath = `./media/${sub.url.split(/[/]+/).pop()}`;
|
|
|
|
let filepath = `./media/${sub.url.split(/[/]+/).pop()}`;
|
|
|
|
|
|
|
|
if (getStat(filepath)===true){ postRandomMeme(); return; }
|
|
|
|
memeHandler.downloadMedia(sub.url, filepath, () => {
|
|
|
|
memeHandler.downloadMedia(sub.url, filepath, () => {
|
|
|
|
client.postMedia(status, filepath, 5, () => postRandomMeme());
|
|
|
|
client.postMedia(status, filepath, 5, () => postRandomMeme());
|
|
|
|
})
|
|
|
|
})
|
|
|
|