@@ -40,6 +40,7 @@ const (
4040 startCommand command = "start"
4141 helpCommand command = "help"
4242 todayCommand command = "today"
43+ tomorrowCommand command = "tomorrow"
4344 dateCommand command = "date" // 2 stages
4445 nextCommand command = "next"
4546 remindCommand command = "remind" // 1 stage
@@ -88,7 +89,7 @@ func (h *Handler) help(ctx context.Context, b *bot.Bot, _ *models.Update) error
8889func (h * Handler ) today (ctx context.Context , b * bot.Bot , _ * models.Update ) error {
8990 chat := getContextChat (ctx )
9091
91- prayerDay , err := h .db .GetPrayerDay (ctx , chat .BotID , h .now (chat .BotID ))
92+ prayerDay , err := h .db .GetPrayerDay (ctx , chat .BotID , h .nowDateUTC (chat .BotID ))
9293 if err != nil {
9394 log .Error ("today: get prayer day" , log .Err (err ), log .BotID (chat .BotID ), log .ChatID (chat .ChatID ))
9495 return domain .ErrInternal
@@ -107,6 +108,29 @@ func (h *Handler) today(ctx context.Context, b *bot.Bot, _ *models.Update) error
107108 return nil
108109}
109110
111+ func (h * Handler ) tomorrow (ctx context.Context , b * bot.Bot , _ * models.Update ) error {
112+ chat := getContextChat (ctx )
113+
114+ tomorrow := h .nowDateUTC (chat .BotID ).Add (24 * time .Hour )
115+ prayerDay , err := h .db .GetPrayerDay (ctx , chat .BotID , tomorrow )
116+ if err != nil {
117+ log .Error ("tomorrow: get prayer day" , log .Err (err ), log .BotID (chat .BotID ), log .ChatID (chat .ChatID ))
118+ return domain .ErrInternal
119+ }
120+
121+ _ , err = b .SendMessage (ctx , & bot.SendMessageParams {
122+ ChatID : chat .ChatID ,
123+ Text : h .formatPrayerDay (chat .BotID , prayerDay , chat .LanguageCode ),
124+ })
125+ if err != nil {
126+ log .Error ("tomorrow: send message" , log .Err (err ), log .BotID (chat .BotID ), log .ChatID (chat .ChatID ))
127+ return domain .ErrInternal
128+ }
129+
130+ h .resetState (ctx , chat )
131+ return nil
132+ }
133+
110134func (h * Handler ) date (ctx context.Context , b * bot.Bot , _ * models.Update ) error {
111135 chat := getContextChat (ctx )
112136
@@ -129,7 +153,7 @@ func (h *Handler) next(ctx context.Context, b *bot.Bot, _ *models.Update) error
129153
130154 var (
131155 now = h .now (chat .BotID )
132- date = now . Truncate ( 24 * time . Hour )
156+ date = h . nowDateUTC ( chat . BotID )
133157 )
134158
135159 prayerDay , err := h .db .GetPrayerDay (ctx , chat .BotID , date )
0 commit comments