mirror of
https://github.com/misenhower/splatoon3.ink.git
synced 2026-03-21 17:54:13 -05:00
Add a Salmon Run gear tweet
This commit is contained in:
parent
203f037408
commit
ec2e5fd82f
43
app/twitter/generators/SalmonRunGearTweet.mjs
Normal file
43
app/twitter/generators/SalmonRunGearTweet.mjs
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
import TweetGenerator from "./TweetGenerator.mjs";
|
||||
import Media from "../Media.mjs";
|
||||
import { useCoopGearStore } from "../../../src/stores/gear.mjs";
|
||||
|
||||
export default class SalmonRunGearTweet extends TweetGenerator
|
||||
{
|
||||
key = 'gear.salmonrun';
|
||||
name = 'Salmon Run Gear';
|
||||
|
||||
async getGear() {
|
||||
await this.preparePinia();
|
||||
|
||||
return useCoopGearStore().monthlyGear;
|
||||
}
|
||||
|
||||
async getDataTime() {
|
||||
let gear = await this.getGear();
|
||||
|
||||
return gear?.__splatoon3ink_id;
|
||||
}
|
||||
|
||||
async shouldTweet() {
|
||||
let gear = await this.getGear();
|
||||
|
||||
let cachedId = await this.lastTweetCache.getData();
|
||||
|
||||
return gear?.__splatoon3ink_id && gear?.__splatoon3ink_id !== cachedId;
|
||||
}
|
||||
|
||||
async _getStatus() {
|
||||
let gear = await this.getGear();
|
||||
|
||||
return `New Salmon Run reward gear is now available! This month's gear is the ${gear.name}. #salmonrun #splatoon3`;
|
||||
}
|
||||
|
||||
/** @param {ScreenshotHelper} screenshotHelper */
|
||||
async _getMedia(screenshotHelper) {
|
||||
let media = new Media;
|
||||
media.file = await screenshotHelper.capture('gear/salmonrun');
|
||||
|
||||
return media;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
import fs from 'fs/promises';
|
||||
import { createPinia, setActivePinia } from 'pinia';
|
||||
import { useFestivalsDataStore, useGearDataStore, useSchedulesDataStore } from '../../../src/stores/data.mjs';
|
||||
import { useCoopDataStore, useFestivalsDataStore, useGearDataStore, useSchedulesDataStore } from '../../../src/stores/data.mjs';
|
||||
import prefixedConsole from '../../common/prefixedConsole.mjs';
|
||||
import Tweet from '../Tweet.mjs';
|
||||
import TwitterClient from '../TwitterClient.mjs';
|
||||
|
|
@ -38,6 +38,7 @@ export default class TweetGenerator
|
|||
|
||||
useSchedulesDataStore().setData(JSON.parse(await fs.readFile('dist/data/schedules.json')));
|
||||
useGearDataStore().setData(JSON.parse(await fs.readFile('dist/data/gear.json')));
|
||||
useCoopDataStore().setData(JSON.parse(await fs.readFile('dist/data/coop.json')));
|
||||
useFestivalsDataStore().setData(JSON.parse(await fs.readFile('dist/data/festivals.json')));
|
||||
|
||||
this._piniaInitialized = true;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import DailyDropGearTweet from "./generators/DailyDropGearTweet.mjs";
|
||||
import RegularGearTweet from "./generators/RegularGearTweet.mjs";
|
||||
import SalmonRunGearTweet from "./generators/SalmonRunGearTweet.mjs";
|
||||
import SalmonRunTweet from "./generators/SalmonRunTweet.mjs";
|
||||
import SchedulesTweet from "./generators/SchedulesTweet.mjs";
|
||||
import SplatfestResultsTweet from "./generators/SplatfestResultsTweet.mjs";
|
||||
|
|
@ -11,6 +12,7 @@ export function defaultTwitterManager() {
|
|||
new DailyDropGearTweet,
|
||||
new RegularGearTweet,
|
||||
new SalmonRunTweet,
|
||||
new SalmonRunGearTweet,
|
||||
new SplatfestResultsTweet,
|
||||
]);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user