Skip to content

Send and receive SMS messages using your Android phone programmatically via a simple HTTP API

Added embed for discord confirmation

Jake Daynes2f6c94a2406e
diff --git a/api/pkg/handlers/discord_handler.go b/api/pkg/handlers/discord_handler.go
index d556dc45..7be60f3b 100644
--- a/api/pkg/handlers/discord_handler.go
+++ b/api/pkg/handlers/discord_handler.go
@@ -375,6 +375,19 @@ func (h *DiscordHandler) sendSMS(ctx context.Context, c *fiber.Ctx, payload map[
},
}
+ if len(request.Attachments) > 0 {
+ var urls []string
+ for _, att := range request.Attachments {
+ urls = append(urls, att.URL)
+ }
+
+ fields := messageEmbed["fields"].([]fiber.Map)
+ messageEmbed["fields"] = append(fields, fiber.Map{
+ "name": "Attachments:",
+ "value": strings.Join(urls, "\n"),
+ })
+ }
+
if errors := h.messageValidator.ValidateMessageSend(ctx, discord.UserID, request.Sanitize()); len(errors) != 0 {
msg := fmt.Sprintf("validation errors [%s], while sending payload [%s]", spew.Sdump(errors), c.Body())
ctxLogger.Warn(stacktrace.NewError(msg))