Skip to content

Commit

Permalink
Add no dinner/breakfast messages
Browse files Browse the repository at this point in the history
  • Loading branch information
athuyaoo committed Sep 28, 2020
1 parent fe10a98 commit 56c67d1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/bot/logic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ const botCommandDictionary: BotCommandDictionary = {
"Tomorrow's Breakfast": {
execute: () => {
const dayTomorrow = (getCurrentDay() % 7) + 1;
if (dayTomorrow === 7) {
return sendMessage('No breakfast on Sundays!');
}
const breakfast = getBreakfast(
getCurrentWeek() + (dayTomorrow === 1 ? 1 : 0),
dayTomorrow
Expand All @@ -67,6 +70,9 @@ const botCommandDictionary: BotCommandDictionary = {
"Today's Dinner": {
execute: () => {
const currentDay = getCurrentDay();
if (currentDay === 6) {
return sendMessage('No dinner on Saturdays!');
}
const dinner = getDinner(getCurrentWeek(), getDinnerColumn(currentDay));
sendMessage(
`Dinner on ${generateDateString(new Date())}\n\n${parseMeal(dinner)}`
Expand All @@ -76,6 +82,9 @@ const botCommandDictionary: BotCommandDictionary = {
"Tomorrow's Dinner": {
execute: () => {
const dayTomorrow = (getCurrentDay() % 7) + 1;
if (dayTomorrow === 6) {
return sendMessage('No dinner on Saturdays!');
}
const dinner = getDinner(
getCurrentWeek() + (dayTomorrow === 1 ? 1 : 0),
dayTomorrow
Expand Down
1 change: 1 addition & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ const getDinner = (week: number, day: number) => {
`Week ${week}`
);
if (!sheet) return;
day = day === 7 ? 6 : day;

const column = String.fromCharCode('B'.charCodeAt(0) + day);
const dinnerData = sheet
Expand Down

0 comments on commit 56c67d1

Please sign in to comment.