add all_lessons

This commit is contained in:
2023-01-11 02:00:07 +07:00
parent 78705f95ea
commit 6325033fdf
8 changed files with 66 additions and 104 deletions
+19 -2
View File
@@ -189,6 +189,9 @@ func run() {
case commands.TomorrowLessons:
sendTomorrowLessonsToChat(bot, chatID, "Завтра, "+update.Message.From.FirstName+", эти пары:")
case commands.AllLessons:
sendAllLessonsToChat(bot, chatID, "Пока знаю про эти пары:")
case commands.Weather:
w, err := weather.GetWeatherWithCache(opts.Key, 53.346853, 83.777012, time.Hour)
if err != nil {
@@ -215,7 +218,7 @@ func sendTodayLessonsToChat(bot *tgbot.BotAPI, chatID int64, prefix string) {
tgbot.NewMessage(
chatID,
messages.LessonsMessage(
parser.ParseByDay(date.Today()),
parser.ParseByDay(date.Today(0)),
prefix,
"Сегодня пар нет",
),
@@ -229,7 +232,7 @@ func sendTomorrowLessonsToChat(bot *tgbot.BotAPI, chatID int64, prefix string) {
tgbot.NewMessage(
chatID,
messages.LessonsMessage(
parser.ParseByDay(date.Today()+1),
parser.ParseByDay(date.Today(24*time.Hour)),
prefix,
"Завтра пар нет",
),
@@ -237,6 +240,20 @@ func sendTomorrowLessonsToChat(bot *tgbot.BotAPI, chatID int64, prefix string) {
)
}
func sendAllLessonsToChat(bot *tgbot.BotAPI, chatID int64, prefix string) {
send(
bot,
tgbot.NewMessage(
chatID,
messages.LessonsMessage(
parser.ParseByDay(""),
prefix,
"Пусто",
),
),
)
}
func sendNewYearToChat(bot *tgbot.BotAPI, chatID int64, imageService new_year_service.NewYearService) {
url := imageService.GetRandomImageURL()
message := imageService.GetRandomMessage()