This commit is contained in:
Martijn de Boer 2018-09-10 21:07:55 +02:00
parent 2ea290cfed
commit 5c613a3527

10
app.js
View file

@ -11,13 +11,15 @@ fs.readFile('.TOKEN', 'utf-8', function(err,data){
process.exit(1);
}
m = new Mastodon({ access_token : data, api_url: 'https://botsin.space/api/v1/' });
m = new Mastodon({ access_token : data.trim(), api_url: 'https://botsin.space/api/v1/' });
console.log('Tooting Scooter quutes!');
ts = Schedule.scheduleJob('1 8 * * 0,3', doQuote);
ts = Schedule.scheduleJob('6 13 * * 2,5', doQuote);
ts = Schedule.scheduleJob('19 18 * * 1,4', doQuote);
ts = Schedule.scheduleJob('31 20 * * 6', doQuote);
doQuote();
});
function doQuote() {
@ -48,9 +50,9 @@ function tootQuote(obj) {
obj.quote &&
obj.quote.text )
{
console.log( 'Tooting: ' + obj.quote.text );
var cw = obj.quote.text;
var message = "from '" + obj.quote.track + "' on the album '" + obj.quote.album + "'\n" + obj.quote.track_master + "\n#quote #scooter #bot";
console.log( 'Tooting: ' + obj.quote.text.trim() + "\n");
var cw = obj.quote.text.trim();
var message = "from '" + obj.quote.track.trim() + "' on the album '" + obj.quote.album.trim() + "'\n" + obj.quote.track_master.trim() + "\n#quote #scooter #bot";
m.post('statuses', { status: message, spoiler_text: cw, visibility: 'public' });
}
}