discord

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCannotConnect = errors.New("cannot connect to the socket/pipe")
)

Functions

This section is empty.

Types

type Activity

type Activity struct {
	State      *string     `json:"state,omitempty"`
	Details    *string     `json:"details,omitempty"`
	Timestamps *Timestamps `json:"timestamps,omitempty"`
	Assets     *Assets     `json:"assets,omitempty"`
}

type Arguments

type Arguments struct {
	Pid      int       `json:"pid,omitempty"`
	Activity *Activity `json:"activity,omitempty"`
}

type Assets

type Assets struct {
	LargeImage string `json:"large_image"`
	LargeText  string `json:"large_text"`
	SmallImage string `json:"small_image"`
	SmallText  string `json:"small_text"`
}

type DiscordPresence

type DiscordPresence struct {
	ClientID string
	// contains filtered or unexported fields
}

func NewDiscordPresence

func NewDiscordPresence(ClientID string) *DiscordPresence

func (*DiscordPresence) Close

func (c *DiscordPresence) Close() error

func (*DiscordPresence) Connect

func (c *DiscordPresence) Connect() error

func (*DiscordPresence) CreateHandshake

func (c *DiscordPresence) CreateHandshake() error

func (*DiscordPresence) Read

func (c *DiscordPresence) Read(b []byte) (n int, err error)

func (*DiscordPresence) Send

func (c *DiscordPresence) Send(opcode OpCode, payload Payload) ([]byte, error)

func (*DiscordPresence) SetActivity

func (c *DiscordPresence) SetActivity(activity *Activity) (string, []byte, error)

func (*DiscordPresence) Write

func (c *DiscordPresence) Write(b []byte) (n int, err error)

type OpCode

type OpCode uint32
const (
	Handshake OpCode = iota
	Frame
	Close
	Ping
	Pong
)

type Payload

type Payload struct {
	Cmd   string      `json:"cmd,omitempty"`
	Args  *Arguments  `json:"args,omitempty"`
	Nonce string      `json:"nonce,omitempty"`
	Data  interface{} `json:"data,omitempty"`

	// Handshake specific data
	ClientID string `json:"client_id,omitempty"`
	Version  int8   `json:"v,omitempty"`
}

type Timestamps

type Timestamps struct {
	Start int `json:"start,omitempty"`
	End   int `json:"end,omitempty"`
}

Jump to

Keyboard shortcuts

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