Skip to content

Commit

Permalink
Add clog to slack handle
Browse files Browse the repository at this point in the history
  • Loading branch information
Robi9 committed Nov 27, 2024
1 parent 24c00d9 commit 8e8ef77
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions handlers/slack/slack.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,32 +153,39 @@ func (h *handler) Send(ctx context.Context, msg courier.Msg, clog *courier.Chann

status := h.Backend().NewMsgStatusForID(msg.Channel(), msg.ID(), courier.MsgErrored, clog)

hasError := true

for _, attachment := range msg.Attachments() {
fileAttachment, err := parseAttachmentToFileParams(msg, attachment, clog)
hasError = err != nil
if err != nil {
clog.RawError(err)
return status, nil
}

if fileAttachment != nil {
err = sendFilePart(msg, botToken, fileAttachment, clog)
hasError = err != nil
if err != nil {
clog.RawError(err)
return status, nil
}
}
}

if len(msg.QuickReplies()) != 0 {
_, err := sendQuickReplies(msg, botToken, clog)
hasError = err != nil
if err != nil {
clog.RawError(err)
return status, nil
}
}

if msg.Text() != "" && len(msg.QuickReplies()) == 0 {
err := sendTextMsgPart(msg, botToken, clog)
hasError = err != nil
}

if !hasError {
status.SetStatus(courier.MsgWired)
if err != nil {
clog.RawError(err)
return status, nil
}
}

status.SetStatus(courier.MsgWired)
return status, nil
}

Expand Down

0 comments on commit 8e8ef77

Please sign in to comment.