format

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package format https://discord.com/developers/docs/reference#message-formatting

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AnimatedEmoji

func AnimatedEmoji[T ID](name string, id T) string

AnimatedEmoji returns a custom animated emoji

func Channel

func Channel[T ID](id T) string

Channel returns a channel mention

func Emoji

func Emoji[T ID](name string, id T) string

Emoji returns a custom emoji

func Role

func Role[T ID](id T) string

Role returns a role mention

func Timestamp

func Timestamp(ts time.Time) string

Timestamp returns a timestamp

func TimestampStyled

func TimestampStyled(ts time.Time, style TimestampStyle) string

TimestampStyled returns a styled timestamp

func User

func User[T ID](id T) string

User returns a user mention

func UserNick

func UserNick[T ID](id T) string

UserNick returns a user (nickname) mention

Types

type ID added in v0.7.2

type ID interface {
	~string | corde.Snowflake
}

ID is a Discord ID, either in string form or Snowflake form

type TimestampStyle

type TimestampStyle string

TimestampStyle https://discord.com/developers/docs/reference#message-formatting-timestamp-styles

const (
	TimestampShortTime     TimestampStyle = "t"
	TimestampLongTime      TimestampStyle = "T"
	TimestampShortDate     TimestampStyle = "d"
	TimestampLongDate      TimestampStyle = "D"
	TimestampShortDateTime TimestampStyle = "f"
	TimestampLongDateTime  TimestampStyle = "F"
	TimestampRelative      TimestampStyle = "R"
)

Jump to

Keyboard shortcuts

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