Temp timezone fix #11
1 changed files with 5 additions and 2 deletions
7
main.go
7
main.go
|
|
@ -72,7 +72,7 @@ func main() {
|
|||
}
|
||||
|
||||
func isScheduledTime(now time.Time) bool {
|
||||
scheduled := []string{"06:45", "07:35", "08:35", "09:25", "10:25", "11:15", "12:45", "13:25"}
|
||||
scheduled := []string{"07:45", "08:35", "09:35", "10:25", "11:25", "12:15", "13:45", "14:25"}
|
||||
current := now.Format("15:04")
|
||||
for _, t := range scheduled {
|
||||
if t == current {
|
||||
|
|
@ -142,6 +142,7 @@ func scheduleTimetableUpdate() {
|
|||
// Ticker for scheduled lesson notifications
|
||||
startMinuteTicker(func() {
|
||||
now := time.Now()
|
||||
now = now.Add(-1 * time.Hour)
|
||||
if isScheduledTime(now) {
|
||||
log.Println("Scheduled time reached, running notifications...")
|
||||
accounts, _ := BotStart.LoadAndDecryptAccounts()
|
||||
|
|
@ -185,7 +186,9 @@ func Run(userID string) {
|
|||
roomByStartTime, _ := MapTimeToRoom(timetableFile)
|
||||
subjectByStartTime, _ := MapTimeToSubject(timetableFile)
|
||||
|
||||
now := time.Now().Format("15:04")
|
||||
nowOld := time.Now()
|
||||
nowOld = nowOld.Add(-1 * time.Hour)
|
||||
now := nowOld.Format("15:04")
|
||||
nextTime, room, foundRoom := NextRoomForTime(roomByStartTime, now)
|
||||
if !foundRoom {
|
||||
return // No upcoming lessons
|
||||
|
|
|
|||
Loading…
Reference in a new issue