presence

package
v0.0.0-...-d931726 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Presence

type Presence struct {
	Game   string `json:"game"`
	Status Status `json:"status"`
}

Presence represents a presence status with a game message and a status string.

func Unmarshal

func Unmarshal(raw string) (*Presence, error)

Unmarshal deserializes the passed raw string to a presence object and returns an error when the raw data has the wrong format.

func (*Presence) Marshal

func (p *Presence) Marshal() string

Marshal produces a raw string from the presence.

func (*Presence) ToUpdateStatusData

func (p *Presence) ToUpdateStatusData() discordgo.UpdateStatusData

ToUpdateStatusData returns a discordgo.UpdateStatusData from the presence object.

func (*Presence) Validate

func (p *Presence) Validate() error

Validate returns an error when either an invalid status was specified or the presence text contains the seperator used for serialization and deserialization.

type Status

type Status string
const (
	StatusOnline    Status = "online"
	StatusDnD       Status = "dnd"
	StatusIdle      Status = "idle"
	StatusInvisible Status = "invisible"
)

Jump to

Keyboard shortcuts

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