Documentation
¶
Index ¶
- Constants
- func GetAttachmentType(contentType string) string
- func HasURL(text string) bool
- func New(dbcon *db.CQLCon, pg *pgdb.DB, storage *s3.Client, t mq.SendTransporter, ...) server.Entity
- func UniqueAttachmentTypes(types []string) []string
- type Direction
- type GetMessagesRequest
- type SendMessageRequest
- type UpdateMessageRequest
- type UploadAttachmentRequest
Constants ¶
View Source
const ( ErrUnableToGetUserToken = "unable to get user token" ErrUnableToParseBody = "unable to parse body" ErrPermissionsRequired = "permissions required" ErrUnableToCreateAttachment = "unable to create attachment" ErrUnableToCreateUploadURL = "unable to create upload url" ErrIncorrectChannelID = "incorrect channel ID" ErrIncorrectMessageID = "incorrect message ID" ErrFileIsTooBig = "file is too big" ErrUnableToSendMessage = "unable to send message" ErrUnableToUpdateMessage = "unable to update message" ErrUnableToGetUser = "unable to get user" ErrUnableToGetGuild = "unable to get guild" ErrUnableToGetUserDiscriminator = "unable to get discriminator" ErrUnableToGetAttachements = "unable to get attachments" ErrUnableToSentToThisChannel = "unable to send to this channel" ErrUnableToReadFromThisChannel = "unable to read from this channel" ErrUnableToGetMessage = "unable to get message" // Validation error messages ErrMessageContentRequired = "message content is required" ErrMessageContentTooLong = "message content must be less than 2000 characters" ErrAttachmentIdInvalid = "attachment ID must be positive" ErrMentionIdInvalid = "mention ID must be positive" ErrFilenameRequired = "filename is required" ErrFilenameTooLong = "filename must be less than 255 characters" ErrFileSizeInvalid = "file size must be positive" ErrFileSizeTooBig = "file size must be less than 100MB" ErrDimensionsInvalid = "width and height must be non-negative" ErrLimitInvalid = "limit must be between 1 and 100" ErrFromIdInvalid = "from ID must be positive" ErrDirectionInvalid = "direction must be 'before' or 'after'" )
View Source
const ( DirectionBefore = Direction("before") DirectionAfter = Direction("after") DirectionAround = Direction("around") )
View Source
const (
DefaultLimit = int(50)
)
View Source
const (
MaxBatchSize = 50 // Maximum messages to process at once
)
Performance optimization constants
Variables ¶
This section is empty.
Functions ¶
func GetAttachmentType ¶
func UniqueAttachmentTypes ¶
Types ¶
type GetMessagesRequest ¶
type GetMessagesRequest struct {
From *int64 `query:"from" json:"from" example:"2230469276416868352"` // ID of the message whe start to look from
Limit *int `query:"limit" json:"limit" example:"30"` // Number of messages to return.
Direction *Direction `query:"direction" json:"direction" enums:"before,after,around" example:"before"` // Direction to look for messages
}
func (GetMessagesRequest) Validate ¶
func (r GetMessagesRequest) Validate() error
type SendMessageRequest ¶
type SendMessageRequest struct {
Content string `json:"content" example:"Hello world!"` // Message content
Attachments []int64 `json:"attachments" example:"2230469276416868352"` // IDs of attached files
Mentions []int64 `json:"mentions" example:"2230469276416868352"` // IDs of mentioned users
}
func (SendMessageRequest) Validate ¶
func (r SendMessageRequest) Validate() error
type UpdateMessageRequest ¶
type UpdateMessageRequest struct {
Content string `json:"content" example:"Hello world!"` // Message content
}
func (UpdateMessageRequest) Validate ¶
func (r UpdateMessageRequest) Validate() error
type UploadAttachmentRequest ¶
type UploadAttachmentRequest struct {
Filename string `json:"filename" example:"image.png"` // File name
FileSize int64 `json:"file_size" example:"100000"` // File size in bytes
Width int64 `json:"width" example:"800"` // Image width in pixels
Height int64 `json:"height" example:"600"` // Image height in pixels
}
func (UploadAttachmentRequest) Validate ¶
func (r UploadAttachmentRequest) Validate() error
Click to show internal directories.
Click to hide internal directories.