|
|
|
@ -3,16 +3,20 @@ import fs from "fs";
|
|
|
|
|
|
|
|
|
|
export class MastodonHandler extends Mastodon{
|
|
|
|
|
postStatus(status){
|
|
|
|
|
this.post('statuses', {status: status})
|
|
|
|
|
.then(console.log("status posted => "))
|
|
|
|
|
.then((resp) => console.log(resp.data));
|
|
|
|
|
this.post('statuses', {status: status}).then((resp) => {
|
|
|
|
|
console.log("status posted => ");
|
|
|
|
|
console.log(resp.data);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
postMedia(status, mediaPath){
|
|
|
|
|
this.post('media', { file: fs.createReadStream(mediaPath) }).then(resp => {
|
|
|
|
|
let id = resp.data.id;
|
|
|
|
|
this.post('statuses', { status: status, media_ids: [id] })
|
|
|
|
|
.then(console.log("media posted => "))
|
|
|
|
|
.then((resp) => console.log(resp.data));
|
|
|
|
|
console.log("media uploaded => ");
|
|
|
|
|
console.log(resp.data);
|
|
|
|
|
this.post('statuses', { status: status, media_ids: [id] }).then((resp) => {
|
|
|
|
|
console.log("media posted => ");
|
|
|
|
|
console.log(resp.data);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|