Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add reaction action for rescheduling repeating events #331

Merged
merged 3 commits into from
Oct 4, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
only add new reaction to recurring events
CubicrootXYZ committed Oct 4, 2024
commit 63af3450e4fe666f8dbf6d713cfa3f935278c518
10 changes: 8 additions & 2 deletions internal/connectors/matrix/send_reminders.go
Original file line number Diff line number Diff line change
@@ -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)
@@ -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,