diff --git a/pkg/internal/server/api/events_message_api.go b/pkg/internal/server/api/events_message_api.go index 084cbb2..690c63c 100644 --- a/pkg/internal/server/api/events_message_api.go +++ b/pkg/internal/server/api/events_message_api.go @@ -28,6 +28,10 @@ func newMessageEvent(c *fiber.Ctx) error { return fiber.NewError(fiber.StatusBadRequest, "message uuid was not valid") } + if len(data.Body.Text) == 0 && len(data.Body.Attachments) == 0 { + return fiber.NewError(fiber.StatusBadRequest, "you cannot send an empty message") + } + var err error var channel models.Channel var member models.ChannelMember @@ -84,6 +88,10 @@ func editMessageEvent(c *fiber.Ctx) error { return err } + if len(data.Body.Text) == 0 && len(data.Body.Attachments) == 0 { + return fiber.NewError(fiber.StatusBadRequest, "you cannot send an empty message") + } + var err error var channel models.Channel var member models.ChannelMember