Documentation ¶
Index ¶
- Variables
- func IsValidBackground(s string) bool
- func IsValidColour(str string) bool
- func IsValidEmbed(s string) bool
- func IsValidHex(str string, allowAlpha bool) bool
- func IsValidImageAlignment(value string) bool
- func IsValidImageProfileBorderType(value string) bool
- func IsValidImageTheme(value string) bool
- func IsValidInteger(str string) bool
- func IsValidUnsplashID(str string) bool
- type Background
- type BackgroundType
- type Colour
- type ImageAlignment
- type ImageProfileBorderType
- type ImageTheme
- type UserProvidedEmbed
- type Welcomer
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidJSON = fmt.Errorf("invalid json") ErrInvalidColour = fmt.Errorf("colour format is not recognised") ErrInvalidBackground = fmt.Errorf("invalid background") CustomBackgroundPrefix = "custom:" SolidColourPrefix = "solid:" SolidColourPrefixBased = "profile" UnsplashPrefix = "unsplash:" RGBAPrefix = "rgba" RGBPrefix = "rgb" RGBRegex = regexp.MustCompile(`^rgb\(([0-9]+)\w+?, ([0-9]+)\w+?, ([0-9]+)\w+?\)$`) RGBARegex = regexp.MustCompile(`^rgba\(([0-9]+)\w+?, ([0-9]+)\w+?, ([0-9].+)\w+?\)$`) )
Functions ¶
func IsValidBackground ¶
func IsValidColour ¶
func IsValidEmbed ¶
func IsValidHex ¶
func IsValidImageAlignment ¶
func IsValidImageTheme ¶
func IsValidInteger ¶
func IsValidUnsplashID ¶
Types ¶
type Background ¶
type Background struct { Type BackgroundType `json:"type"` // Background specific values. Value string `json:"value"` }
func ParseBackground ¶
func ParseBackground(str string) (*Background, error)
ParseBackground parses a background string provided by user. Expected formats: solid:FFAAAA - Solid colour with HEX code. solid:profile - Solid colour based on user profile picture. unsplash:Bnr_ZSmqbDY - Unsplash along with Id. custom_341685098468343822 - per-guild welcomer background
type BackgroundType ¶
type BackgroundType int32
ENUM(default, welcomer, solid, solidProfile, unsplash, url)
const ( // BackgroundTypeDefault is a BackgroundType of type Default. BackgroundTypeDefault BackgroundType = iota // BackgroundTypeWelcomer is a BackgroundType of type Welcomer. BackgroundTypeWelcomer // BackgroundTypeSolid is a BackgroundType of type Solid. BackgroundTypeSolid // BackgroundTypeSolidProfile is a BackgroundType of type SolidProfile. BackgroundTypeSolidProfile // BackgroundTypeUnsplash is a BackgroundType of type Unsplash. BackgroundTypeUnsplash // BackgroundTypeUrl is a BackgroundType of type Url. BackgroundTypeUrl )
func ParseBackgroundType ¶
func ParseBackgroundType(name string) (BackgroundType, error)
ParseBackgroundType attempts to convert a string to a BackgroundType.
func (BackgroundType) MarshalText ¶
func (x BackgroundType) MarshalText() ([]byte, error)
MarshalText implements the text marshaller method.
func (BackgroundType) String ¶
func (x BackgroundType) String() string
String implements the Stringer interface.
func (*BackgroundType) UnmarshalText ¶
func (x *BackgroundType) UnmarshalText(text []byte) error
UnmarshalText implements the text unmarshaller method.
type ImageAlignment ¶
type ImageAlignment int32
ENUM(left, center, right, topLeft, topCenter, topRight, bottomLeft, bottomCenter, bottomRight)
const ( // ImageAlignmentLeft is a ImageAlignment of type Left. ImageAlignmentLeft ImageAlignment = iota // ImageAlignmentCenter is a ImageAlignment of type Center. ImageAlignmentCenter // ImageAlignmentRight is a ImageAlignment of type Right. ImageAlignmentRight // ImageAlignmentTopLeft is a ImageAlignment of type TopLeft. ImageAlignmentTopLeft // ImageAlignmentTopCenter is a ImageAlignment of type TopCenter. ImageAlignmentTopCenter // ImageAlignmentTopRight is a ImageAlignment of type TopRight. ImageAlignmentTopRight // ImageAlignmentBottomLeft is a ImageAlignment of type BottomLeft. ImageAlignmentBottomLeft // ImageAlignmentBottomCenter is a ImageAlignment of type BottomCenter. ImageAlignmentBottomCenter // ImageAlignmentBottomRight is a ImageAlignment of type BottomRight. ImageAlignmentBottomRight )
func ParseImageAlignment ¶
func ParseImageAlignment(name string) (ImageAlignment, error)
ParseImageAlignment attempts to convert a string to a ImageAlignment.
func (ImageAlignment) MarshalText ¶
func (x ImageAlignment) MarshalText() ([]byte, error)
MarshalText implements the text marshaller method.
func (ImageAlignment) String ¶
func (x ImageAlignment) String() string
String implements the Stringer interface.
func (*ImageAlignment) UnmarshalText ¶
func (x *ImageAlignment) UnmarshalText(text []byte) error
UnmarshalText implements the text unmarshaller method.
type ImageProfileBorderType ¶
type ImageProfileBorderType int32
ENUM(circular, rounded, squared, hexagonal)
const ( // ImageProfileBorderTypeCircular is a ImageProfileBorderType of type Circular. ImageProfileBorderTypeCircular ImageProfileBorderType = iota // ImageProfileBorderTypeRounded is a ImageProfileBorderType of type Rounded. ImageProfileBorderTypeRounded // ImageProfileBorderTypeSquared is a ImageProfileBorderType of type Squared. ImageProfileBorderTypeSquared // ImageProfileBorderTypeHexagonal is a ImageProfileBorderType of type Hexagonal. ImageProfileBorderTypeHexagonal )
func ParseImageProfileBorderType ¶
func ParseImageProfileBorderType(name string) (ImageProfileBorderType, error)
ParseImageProfileBorderType attempts to convert a string to a ImageProfileBorderType.
func (ImageProfileBorderType) MarshalText ¶
func (x ImageProfileBorderType) MarshalText() ([]byte, error)
MarshalText implements the text marshaller method.
func (ImageProfileBorderType) String ¶
func (x ImageProfileBorderType) String() string
String implements the Stringer interface.
func (*ImageProfileBorderType) UnmarshalText ¶
func (x *ImageProfileBorderType) UnmarshalText(text []byte) error
UnmarshalText implements the text unmarshaller method.
type ImageTheme ¶
type ImageTheme int32
ENUM(default, vertical, card)
const ( // ImageThemeDefault is a ImageTheme of type Default. ImageThemeDefault ImageTheme = iota // ImageThemeVertical is a ImageTheme of type Vertical. ImageThemeVertical // ImageThemeCard is a ImageTheme of type Card. ImageThemeCard )
func ParseImageTheme ¶
func ParseImageTheme(name string) (ImageTheme, error)
ParseImageTheme attempts to convert a string to a ImageTheme.
func (ImageTheme) MarshalText ¶
func (x ImageTheme) MarshalText() ([]byte, error)
MarshalText implements the text marshaller method.
func (ImageTheme) String ¶
func (x ImageTheme) String() string
String implements the Stringer interface.
func (*ImageTheme) UnmarshalText ¶
func (x *ImageTheme) UnmarshalText(text []byte) error
UnmarshalText implements the text unmarshaller method.