get absentees from database for scheduled reminder

William Perron 1 year ago
parent 78fb5e122c
commit 01bb8491c1
Signed by: wperron
GPG Key ID: BFDB4EF72D73C5F2

@ -530,7 +530,20 @@ func main() {
case <-ctx.Done():
return
case <-notifChan:
_, err := discord.ChannelMessageSend(channelId, "don't forget we have a session next %s!")
absentees, err := store.GetAbsentees(ctx, themis.NextMonday())
if err != nil {
log.Error().Err(err).Msg("failed to get absentees for next session")
return
}
var msg string
if len(absentees) == 0 {
msg = "Everybody can make it next Monday, see you then!"
} else {
msg = fmt.Sprintf("%s can't make it next Monday.", strings.Join(absentees, ", "))
}
_, err = discord.ChannelMessageSend(channelId, msg)
if err != nil {
log.Error().Err(err).Msg("failed to send scheduled notification")
}

Loading…
Cancel
Save