Сделал weekday для сообщения
This commit is contained in:
parent
f38fca44fb
commit
454f544bf3
28
date/date.go
28
date/date.go
|
@ -9,3 +9,31 @@ func Today(offset time.Duration) string {
|
||||||
}
|
}
|
||||||
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 ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import (
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
"student_bot/date"
|
||||||
"student_bot/new_year_service"
|
"student_bot/new_year_service"
|
||||||
"student_bot/parser"
|
"student_bot/parser"
|
||||||
"time"
|
"time"
|
||||||
|
@ -60,7 +61,7 @@ func LessonsMessage(schedule []parser.Lesson, prefix, emptyText string) string {
|
||||||
s += "\n"
|
s += "\n"
|
||||||
}
|
}
|
||||||
endDate = l.TimeStart.Format("02.01")
|
endDate = l.TimeStart.Format("02.01")
|
||||||
s += endDate + "\n"
|
s += endDate + " " + date.GetTranslatedWeekday(l.TimeStart) + "\n"
|
||||||
}
|
}
|
||||||
if strings.Contains(l.User, "Ярных В.В.") {
|
if strings.Contains(l.User, "Ярных В.В.") {
|
||||||
s += "⭐️ "
|
s += "⭐️ "
|
||||||
|
|
Loading…
Reference in New Issue