Skip to content

Commit a80de4d

Browse files
committed
Reaction: state that it was applied to correct message
1 parent 16852e3 commit a80de4d

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

pkg/ircslack/event_handler.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,17 @@ func getConversationDetails(
157157
return slack.Message{}, err
158158
}
159159
if len(message.Messages) > 0 {
160+
// If the timestamps are not equal, we're looking for a threaded message
161+
if message.Messages[0].Timestamp != timestamp {
162+
msgs, _, _, err := ctx.SlackClient.GetConversationReplies(&slack.GetConversationRepliesParameters{ ChannelID: channelID, Timestamp: message.Messages[0].Timestamp })
163+
if err == nil {
164+
for _, msg := range msgs {
165+
if msg.Timestamp == timestamp { return msg, nil }
166+
}
167+
}
168+
// TODO: Always find the message, or return better fallback
169+
log.Warningf("Did not find threaded message with timestamp %v from %v", timestamp, message.Messages[0]);
170+
}
160171
return message.Messages[0], nil
161172
}
162173
return slack.Message{}, fmt.Errorf("No such message found")

0 commit comments

Comments
 (0)