From 2c09b3ab5a089d757511174f23e1f64947e38c25 Mon Sep 17 00:00:00 2001 From: far-galaxy Date: Fri, 11 Aug 2023 18:52:39 +0400 Subject: [PATCH] =?UTF-8?q?=D0=98=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD?= =?UTF-8?q?=D0=BE:=20=D1=80=D0=B0=D0=B7=D0=B4=D0=B5=D0=BB=D0=B5=D0=BD?= =?UTF-8?q?=D0=BE=20=D0=B2=D1=80=D0=B5=D0=BC=D1=8F=20=D1=83=D0=B4=D0=B0?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=B8=D1=8F=20=D1=83=D0=B2=D0=B5=D0=B4=D0=BE?= =?UTF-8?q?=D0=BC=D0=BB=D0=B5=D0=BD=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/notify/notify.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/modules/notify/notify.go b/modules/notify/notify.go index 696b34c..6cb2623 100644 --- a/modules/notify/notify.go +++ b/modules/notify/notify.go @@ -177,13 +177,16 @@ func Mailing(bot *tg.Bot, notes []Notify, now time.Time) { } var txt string var err error + var tempTime time.Time switch note.NotifyType { case NextLesson: query.NextNote = true txt, err = StrNext(bot.DB, note) + tempTime = note.Lesson.Begin.Add(15 * time.Minute) case NextDay: query.NextDay = true txt, err = StrNextDay(bot, note) + tempTime = note.Lesson.Begin.Add(-60 * time.Minute) case NextWeek: query.NextWeek = true } @@ -207,11 +210,12 @@ func Mailing(bot *tg.Bot, notes []Notify, now time.Time) { if err != nil { log.Println(err) } - if _, err := bot.DB.InsertOne(database.TempMsg{ + temp := database.TempMsg{ TgId: m.Chat.ID, MessageId: m.MessageID, - Destroy: note.Lesson.Begin.Add(15 * time.Minute), - }); err != nil { + Destroy: tempTime, + } + if _, err := bot.DB.InsertOne(temp); err != nil { log.Println(err) } ids = append(ids, user.TgId)