Skip to content

Commit

Permalink
fix: Future Big Run message.
Browse files Browse the repository at this point in the history
  • Loading branch information
sasagar committed Jun 4, 2023
1 parent e5ee201 commit ee89662
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
node_modules/
.env
docs/
.env
10 changes: 8 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,13 @@ const salmonrun = async () => {
let msg = now.maker();
// もし残りが2時間なら次のシフトのお知らせを追加
if (restOfHours === 2) {
const next = new MessageMaker(res.data.regular[i + 1], 40, false, true);
const next = new MessageMaker(res.data.regular[0], 40, false, true);

msg += "\n---\n";
msg += next.maker();

// 一回だけ1時間おきにしたいので、追加する
const extraNoteDate = new Date((res.data.regular[i].endunix - 60 * 60) * 1000);
const extraNoteDate = new Date((res.data.bigrun[0].endunix - 60 * 60) * 1000);
console.log(extraNoteDate.toLocaleString());
// eslint-disable-next-line no-use-before-define
salmonjobExtra = schedule.scheduleJob(extraNoteDate, () => { salmonrunextra() });
Expand Down Expand Up @@ -205,6 +205,12 @@ const salmonrun = async () => {
salmonjobExtra = schedule.scheduleJob(extraNoteDate, () => { salmonrunextra() });
console.log(`set: salmonrunextra at ${extraNoteDate}`);
}
// ビッグランの情報を付ける
else {
const bigrun = new MessageMaker(res.data.bigrun[0], 48, false, false, true, false, true);
msg += "\n---\n";
msg += bigrun.maker();
}

sendMessage(msg);
}
Expand Down
2 changes: 2 additions & 0 deletions message-maker.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ const MessageMaker = class {
msg += "**ただいまのシフト**";
}

msg += "\n";

if (this.isNext || this.isFutureBigRun) {
msg += `${format(utcToZonedTime(new Date(this.shift.startunix * 1000), 'Asia/Tokyo'), 'M月d日(E) HH:mm', { locale: ja })}スタート!`;
} else {
Expand Down

0 comments on commit ee89662

Please sign in to comment.