mirror of
https://github.com/misenhower/splatoon2.ink.git
synced 2026-09-14 13:35:14 -05:00
Use alternate text for the schedule tweet when there's a new stage
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
const TwitterPostBase = require('./TwitterPostBase');
|
||||
const { captureScheduleScreenshot } = require('../screenshots');
|
||||
const { readData } = require('../utilities');
|
||||
const { readData, readJson } = require('../utilities');
|
||||
const path = require('path');
|
||||
|
||||
const stagesPath = path.resolve('storage/stages.json');
|
||||
|
||||
class ScheduleTweet extends TwitterPostBase {
|
||||
getKey() { return 'schedule'; }
|
||||
@@ -23,6 +26,17 @@ class ScheduleTweet extends TwitterPostBase {
|
||||
}
|
||||
|
||||
getText(data) {
|
||||
// Load known stages
|
||||
let stages = readJson(stagesPath);
|
||||
|
||||
for (let stage of [data.stage_a, data.stage_b]) {
|
||||
let stageInfo = stages.find(s => s.id == stage.id);
|
||||
|
||||
// If this is the first time the stage has been available, return some different text
|
||||
if (stageInfo && stageInfo.first_available == data.start_time)
|
||||
return `New stage ${stage.name} is now open! #splatoon2`;
|
||||
}
|
||||
|
||||
return 'Current Splatoon 2 map rotation';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user