validation

package
v0.0.0-...-e37856b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 9, 2025 License: LGPL-2.1 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxMessageLength       = 2000
	MaxEmbedLength         = 6000
	MaxEmbedTitleLength    = 256
	MaxEmbedDescLength     = 4096
	MaxEmbedFieldCount     = 25
	MaxEmbedFieldName      = 256
	MaxEmbedFieldValue     = 1024
	MaxEmbedFooterLength   = 2048
	MaxEmbedAuthorLength   = 256
	MaxAttachmentSize      = 8388608   // 8MB for normal users
	MaxAttachmentSizeBoost = 104857600 // 100MB for boosted servers
)

Variables

This section is empty.

Functions

func CountMentions

func CountMentions(content string) map[string]int

func EscapeMarkdown

func EscapeMarkdown(text string) string

func HasExcessiveMentions

func HasExcessiveMentions(content string, threshold int) bool

func IsValidChannelMention

func IsValidChannelMention(mention string) (string, bool)

func IsValidChannelName

func IsValidChannelName(name string) error

func IsValidEmoji

func IsValidEmoji(emoji string) (name string, id string, animated bool, valid bool)

func IsValidInviteCode

func IsValidInviteCode(text string) (string, bool)

func IsValidNickname

func IsValidNickname(nickname string) error

func IsValidRoleMention

func IsValidRoleMention(mention string) (string, bool)

func IsValidRoleName

func IsValidRoleName(name string) error

func IsValidSnowflake

func IsValidSnowflake(id string) bool

func IsValidUserMention

func IsValidUserMention(mention string) (string, bool)

func IsValidUsername

func IsValidUsername(username string) error

func IsValidWebhookURL

func IsValidWebhookURL(url string) (id string, valid bool)

func ParseChannelIDFromMention

func ParseChannelIDFromMention(mention string) (string, error)

func ParseRoleIDFromMention

func ParseRoleIDFromMention(mention string) (string, error)

func ParseUserIDFromMention

func ParseUserIDFromMention(mention string) (string, error)

func SplitMessage

func SplitMessage(content string, maxLength int) []string

func StripMentions

func StripMentions(content string) string

func TruncateMessage

func TruncateMessage(content string, maxLength int) string

func ValidateEmbedAuthor

func ValidateEmbedAuthor(name string) error

func ValidateEmbedDescription

func ValidateEmbedDescription(description string) error

func ValidateEmbedFieldName

func ValidateEmbedFieldName(name string) error

func ValidateEmbedFieldValue

func ValidateEmbedFieldValue(value string) error

func ValidateEmbedFooter

func ValidateEmbedFooter(text string) error

func ValidateEmbedTitle

func ValidateEmbedTitle(title string) error

func ValidateMessageContent

func ValidateMessageContent(content string) error

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL