Skip to content

Commit

Permalink
only add new reaction to recurring events
Browse files Browse the repository at this point in the history
  • Loading branch information
CubicrootXYZ committed Oct 4, 2024
1 parent 8cf23e8 commit 63af345
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions internal/connectors/matrix/send_reminders.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import (
"github.com/CubicrootXYZ/matrix-reminder-and-calendar-bot/internal/daemon"
)

var ReminderReactions = []string{"✅", "▶️", "⏩", "1️⃣", "4️⃣", "🔂"}
var ReminderReactions = []string{"✅", "▶️", "⏩", "1️⃣", "4️⃣"}
var ReminderReactionsRecurring = []string{"🔂"}

func (service *service) SendReminder(event *daemon.Event, output *daemon.Output) error {
room, err := service.matrixDatabase.GetRoomByID(output.OutputID)
Expand Down Expand Up @@ -53,7 +54,12 @@ func (service *service) SendReminder(event *daemon.Event, output *daemon.Output)
service.logger.Errorf("failed to save message to database: %v", err)
}

for _, reaction := range ReminderReactions {
reactions := ReminderReactions
if event.RepeatInterval != nil {
reactions = append(reactions, ReminderReactionsRecurring...)
}

for _, reaction := range reactions {
err := service.messenger.SendReactionAsync(&messenger.Reaction{
Reaction: reaction,
ChannelExternalIdentifier: room.RoomID,
Expand Down

0 comments on commit 63af345

Please sign in to comment.