Bumped birthday announcements to 2 weeks.
This commit is contained in:
parent
71a487feba
commit
a8d812495a
3 changed files with 4 additions and 6 deletions
|
|
@ -105,7 +105,7 @@ func (a *App) daily() {
|
|||
if time.Now().Format("Monday") == a.settings.Scheduler.Announcements.Weekly {
|
||||
bdays, err := a.db.Birthdays().BirthdaysThisWeek(chat.ID)
|
||||
if err == nil && len(bdays) > 0 {
|
||||
sb.WriteString("**<u>Birthdays this week (Sunday-to-Sunday):</u>**\n\n")
|
||||
sb.WriteString("**<u>Upcoming Birthdays (next 2 weeks):</u>**\n\n")
|
||||
for _, bday := range bdays {
|
||||
d, derr := time.Parse("2006-01-02", bday.Birthdate)
|
||||
if derr == nil {
|
||||
|
|
|
|||
|
|
@ -110,14 +110,12 @@ func (b *birthday) ListWeeklyBirthdays(ctx context.Context, cmd *cli.Command) er
|
|||
}
|
||||
return err
|
||||
}
|
||||
logger.Info("Upcoming Birthdays (next 2 weeks):")
|
||||
logger.Info("=======================================")
|
||||
if len(bdays) == 0 {
|
||||
logger.Info("Birthdays this week (Sunday to Sunday):")
|
||||
logger.Info("=======================================")
|
||||
logger.Info(" (none)")
|
||||
return nil
|
||||
}
|
||||
logger.Info("Birthdays this week (Sunday to Sunday):")
|
||||
logger.Info("=======================================")
|
||||
for _, bday := range bdays {
|
||||
d, err := time.Parse("2006-01-02", bday.Birthdate)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ func (bm *BirthdayModel) BirthdaysThisWeek(chatid int64) ([]*Birthday, error) {
|
|||
chatid = ? and
|
||||
birthdate != date('now', 'localtime') and
|
||||
(birthdate >= date('now', 'localtime', 'weekday 0') and
|
||||
birthdate <= date('now', 'localtime', 'weekday 0', '+7 days')) order by birthdate asc;`
|
||||
birthdate <= date('now', 'localtime', 'weekday 0', '+14 days')) order by birthdate asc;`
|
||||
err := bm.db.SelectContext(bm.ctx, &bdays, q, chatid)
|
||||
if err != nil {
|
||||
var serr sqlite3.Error
|
||||
|
|
|
|||
Loading…
Reference in a new issue