Skip to content

Commit

Permalink
Merge branch 'mastodon' of github.com:8bitkick/BBCMicroBot into mastodon
Browse files Browse the repository at this point in the history
  • Loading branch information
8bitkick committed Jan 23, 2024
2 parents 1b6af9e + 1b1088f commit 4bc5ef7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
3 changes: 1 addition & 2 deletions client.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,7 @@ var clientID = "Cli0";
let tag = (TEST || TRY) ? "test" : await cache(tootData, beebState);

// Post a video toot
await mastodon.videoReply(mediaFilename,mediaType,tweet.id,"@"+tweet.account.acct,tweet,checksum,hasAudio,tag);
exec('rm '+mediaFilename);
mastodon.videoReply(mediaFilename,mediaType,tweet.id,"@"+tweet.account.acct,tweet,checksum,hasAudio,tag);
}

setTimeout(requestTweet, POLL_DELAY);
Expand Down
14 changes: 14 additions & 0 deletions mastodon.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,18 @@ const config = {
const mastodon = new Mastodon(config);
const fs = require('fs');

function exec(cmd) {
const exec = require('child_process').exec;
return new Promise((resolve, reject) => {
exec(cmd, (error, stdout, stderr) => {
if (error) {
console.warn(error);
}
resolve(stdout? stdout.trim() : stderr);
});
});
}

function post(path, params) {
log.info("Post", path, params)
}
Expand Down Expand Up @@ -53,6 +65,8 @@ async function videoReply(filename, mediaType, replyTo, text, toot, checksum, ha
await mastodon.post('statuses/' + response.data.id + '/reblog');
}

exec('rm '+filename);

//return {full:"https://bbcmic.ro/"+experimental+"#"+progData,key:short_url}
}

Expand Down

0 comments on commit 4bc5ef7

Please sign in to comment.