Skip to content

Commit 2f6c94a

Browse files
Added embed for discord confirmation
1 parent a0fc868 commit 2f6c94a

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

api/pkg/handlers/discord_handler.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,19 @@ func (h *DiscordHandler) sendSMS(ctx context.Context, c *fiber.Ctx, payload map[
375375
},
376376
}
377377

378+
if len(request.Attachments) > 0 {
379+
var urls []string
380+
for _, att := range request.Attachments {
381+
urls = append(urls, att.URL)
382+
}
383+
384+
fields := messageEmbed["fields"].([]fiber.Map)
385+
messageEmbed["fields"] = append(fields, fiber.Map{
386+
"name": "Attachments:",
387+
"value": strings.Join(urls, "\n"),
388+
})
389+
}
390+
378391
if errors := h.messageValidator.ValidateMessageSend(ctx, discord.UserID, request.Sanitize()); len(errors) != 0 {
379392
msg := fmt.Sprintf("validation errors [%s], while sending payload [%s]", spew.Sdump(errors), c.Body())
380393
ctxLogger.Warn(stacktrace.NewError(msg))

0 commit comments

Comments
 (0)