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
+14 -3
View File
@@ -29,7 +29,7 @@ func ThanksMessage() string {
}
func HelpMessage(chatID int64) string {
return "Вот чем я могу вам помочь (v1.3.0), отправь:\n\n" +
return "Вот чем я могу вам помочь (v1.4.0), отправь:\n\n" +
"- /ping отобью pong\n" +
"- /today_lessons покажу расписание на сегодня\n" +
"- /tomorrow_lessons покажу расписание на завтра\n" +
@@ -52,11 +52,22 @@ func LessonsMessage(schedule []parser.Lesson, prefix, emptyText string) string {
if prefix != "" {
s += prefix + "\n\n"
}
endDate := ""
for _, l := range schedule {
if endDate != l.TimeStart.Format("01.02") {
if endDate != "" {
s += "\n"
}
endDate = l.TimeStart.Format("01.02")
s += endDate + "\n"
}
if strings.Contains(l.User, "Ярных В.В.") {
s += "⭐️ "
}
s += fmt.Sprintf("%s %s (%s)\n", l.Time, l.Name, l.Place)
l.Name = strings.ReplaceAll(l.Name, l.Place, "")
l.Name = strings.ReplaceAll(l.Name, "()", "")
l.Name = strings.TrimSpace(l.Name)
s += fmt.Sprintf("%s %s (%s)\n", l.TimeMsg, l.Name, l.Place)
}
if prefix != "" {
s += "\n" +
@@ -92,7 +103,7 @@ func WeatherMessage(w weather.Weather) string {
func NewYearMessage(message new_year_service.NewYearMessage) string {
loc := time.FixedZone("UTC+7", +7*60*60)
ny := time.Date(2023, 1, 1, 0, 0, 0, 0, loc)
ny := time.Date(2024, 1, 1, 0, 0, 0, 0, loc)
now := time.Now().In(loc)
days := ny.Sub(now).Hours() / 24
if message.Header != "" {