chat

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2024 License: MIT Imports: 4 Imported by: 5

Documentation

Index

Constants

View Source
const ColorAChar = '&'
View Source
const ColorCChar = '§'

Variables

This section is empty.

Functions

func Translate

func Translate(text string) string

func TranslateConsole

func TranslateConsole(text string) string

Types

type ChatColor

type ChatColor int
const (
	DarkRed ChatColor = iota
	Red

	Gold
	Yellow

	DarkGreen
	Green

	DarkAqua
	Aqua

	DarkBlue
	Blue

	DarkPurple
	Purple

	White
	Black

	DarkGray
	Gray

	Obfuscated
	Bold
	Strikethrough
	Underline
	Italic
	Reset
)

func (*ChatColor) MarshalJSON

func (code *ChatColor) MarshalJSON() ([]byte, error)

func (*ChatColor) On

func (code *ChatColor) On(text string) string

func (ChatColor) String

func (code ChatColor) String() string

func (*ChatColor) UnmarshalJSON

func (code *ChatColor) UnmarshalJSON(bytes []byte) error

type ColorCode

type ColorCode struct {
	Chat string
	Motd string
	Json string

	Dec string
	Hex string
}

type Message

type Message struct {
	Text  string     `json:"text"`
	Color *ChatColor `json:"color,string,omitempty"`

	Bold          *bool `json:"bold,boolean,omitempty"`
	Italic        *bool `json:"italic,boolean,omitempty"`
	Underlined    *bool `json:"underlined,boolean,omitempty"`
	Strikethrough *bool `json:"strikethrough,boolean,omitempty"`
	Obfuscated    *bool `json:"obfuscated,boolean,omitempty"`

	Extra []*Message `json:"extra,omitempty"`
	// contains filtered or unexported fields
}

func New

func New(text string) *Message

func (*Message) Add

func (c *Message) Add(text string) *Message

creates and returns a new Chat object, and adds it to the caller's extra slice

func (*Message) AsJson

func (c *Message) AsJson() string

func (*Message) AsText

func (c *Message) AsText() string

func (*Message) Reset

func (c *Message) Reset() *Message

func (*Message) SetBold

func (c *Message) SetBold(value bool) *Message

func (*Message) SetColor

func (c *Message) SetColor(code ChatColor) *Message

func (*Message) SetItalic

func (c *Message) SetItalic(value bool) *Message

func (*Message) SetObfuscated

func (c *Message) SetObfuscated(value bool) *Message

func (*Message) SetStrikethrough

func (c *Message) SetStrikethrough(value bool) *Message

func (*Message) SetUnderlined

func (c *Message) SetUnderlined(value bool) *Message

func (*Message) String

func (c *Message) String() string

type MessagePosition

type MessagePosition byte
const (
	NormalChat MessagePosition = iota
	SystemChat
	HotBarText
)

Jump to

Keyboard shortcuts

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