|
|
|
@ -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")
|
|
|
|
|
}
|
|
|
|
|