diff --git a/date/date.go b/date/date.go index 43551b4..634193b 100644 --- a/date/date.go +++ b/date/date.go @@ -7,5 +7,33 @@ func Today(offset time.Duration) string { if err != nil { panic(err) } - return time.Now().In(location).Add(offset).Format("2006-01-02") + return time.Now().In(location).Add(offset).Format("2006-01-02") +} + +func GetTranslatedWeekday(date time.Time) string { + switch date.Weekday() { + case time.Monday: + return "Понедельник" + + case time.Tuesday: + return "Вторник" + + case time.Wednesday: + return "Среда" + + case time.Thursday: + return "Четверг" + + case time.Friday: + return "Пятница" + + case time.Saturday: + return "Суббота" + + case time.Sunday: + return "Воскресенье" + + default: + return "" + } } diff --git a/messages/messages.go b/messages/messages.go index ec45b5f..c1e8f8d 100644 --- a/messages/messages.go +++ b/messages/messages.go @@ -5,6 +5,7 @@ import ( "math/rand" "strconv" "strings" + "student_bot/date" "student_bot/new_year_service" "student_bot/parser" "time" @@ -60,7 +61,7 @@ func LessonsMessage(schedule []parser.Lesson, prefix, emptyText string) string { s += "\n" } endDate = l.TimeStart.Format("02.01") - s += endDate + "\n" + s += endDate + " " + date.GetTranslatedWeekday(l.TimeStart) + "\n" } if strings.Contains(l.User, "Ярных В.В.") { s += "⭐️ "