(int)(new DateTimeImmutable('third monday of this month'))->format('d'),
(int)(new DateTimeImmutable('fourth monday of this month'))->format('d'),
];
-$currentMonth = (new DateTimeImmutable())->format('m');
+$currentMonth = (int)(new DateTimeImmutable())->format('m');
$currentDayOfMonth = closest((new DateTimeImmutable())->format('d'), $mondays);
$currentWeekOfMonth = array_search($currentDayOfMonth, $mondays);
$taskLists = array_merge(
- isStartOfSeason($currentMonth, $currentDayOfMonth) ? [unlines(map(getString)(getTasksForTheSeason(getSeason($currentMonth), $taskMatrix)))] : [],
- isStartOfMonth($currentDayOfMonth) ? [unlines(map(getString)(getTasksForTheMonth($currentMonth, $taskMatrix)))] : [],
- [unlines(map(getString)(getTasksForTheWeek($currentWeekOfMonth, $currentMonth, $taskMatrix)))]
+ isStartOfSeason($currentMonth, $currentDayOfMonth) ? [unlines(map(getStringAndCode)(getTasksForTheSeason(getSeason($currentMonth), $taskMatrix)))] : [],
+ isStartOfMonth($currentDayOfMonth) ? [unlines(map(getStringAndCode)(getTasksForTheMonth($currentMonth, $taskMatrix)))] : [],
+ [unlines(map(getStringAndCode)(getTasksForTheWeek($currentWeekOfMonth, $currentMonth, $taskMatrix)))]
);
$taskMessages = [
)
);
},
- // Magic. startOfSeason implis startofMonth so we get 2, start of month without start of season gives 1 and
+ // Magic. startOfSeason implies startofMonth so we get 2, start of month without start of season gives 1 and
// a regular week (not the start of a season or month) gives 0. And this is how the indicies are ordered in the array.
$taskMessages[isStartOfSeason($currentMonth, $currentDayOfMonth) + isStartOfMonth($currentDayOfMonth)],
$taskLists
sendToGroupChat($message);
sleep(rand(2,4));
}
-
-$seasonalMemes = [
- 'summer' => ['https://www.youtube.com/watch?v=NqktmrKB3ko']
-];
-
-if (isStartOfSeason($currentMonth, $currentDayOfMonth)) {
- sendToGroupChat(getString('seasonalMeme', $seasonalMemes[getSeason($currentMonth)][array_rand($seasonalMemes[getSeason($currentMonth)])]));
-}