Documentation
¶
Index ¶
Constants ¶
View Source
const (
API_URL = "https://api.lanyard.rest/v1/users/"
)
View Source
const (
PING_PERIOD = 30 * time.Second
)
View Source
const (
WS_URL = "wss://api.lanyard.rest/socket"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Activity ¶
type Activity struct {
Type int `json:"type"`
State string `json:"state"`
Name string `json:"name"`
Id string `json:"id"`
Emoji *Emoji `json:"emoji"`
CreatedAt int `json:"created_at"`
ApplicationId string `json:"application_id"`
Timestamps *Timestamps `json:"timestamps"`
SessionId string `json:"session_id"`
Details *string `json:"details"`
Buttons *[]string `json:"buttons"`
Assets *Assets `json:"assets"`
}
type DiscordUser ¶
type LanyardData ¶
type LanyardData struct {
Spotify Spotify `json:"spotify"`
ListeningToSpotify bool `json:"listening_to_spotify"`
DiscordUser DiscordUser `json:"discord_user"`
DiscordStatus string `json:"discord_status"`
Kv map[string]string `json:"kv"`
Activities []Activity `json:"activities"`
ActiveOnDiscordMobile bool `json:"active_on_discord_mobile"`
ActiveOnDiscordDesktop bool `json:"active_on_discord_desktop"`
}
type LanyardError ¶
type LanyardResponse ¶
type LanyardResponse struct {
Success bool `json:"success"`
Data *LanyardData `json:"data"`
Error *LanyardError `json:"error"`
}
I'm not entirely sure if these are correct. You can review and open a PR before using it. Go port of https://github.com/barbarbar338/react-use-lanyard/blob/main/src/types.ts
func FetchUser ¶
func FetchUser(userId string) (LanyardResponse, error)
type LanyardWSResponse ¶
type LanyardWSResponse struct {
Op int `json:"op"`
Seq int `json:"seq"`
T string `json:"t"`
D *LanyardData `json:"d"`
}
type Timestamps ¶
type WSClient ¶
type WSClient struct {
// contains filtered or unexported fields
}
func ListenMultipleUsers ¶ added in v0.2.0
func ListenMultipleUsers(userIds []string, presenceUpdate func(data *LanyardData)) WSClient
func ListenUser ¶ added in v0.2.0
func ListenUser(userId string, presenceUpdate func(data *LanyardData)) WSClient
Click to show internal directories.
Click to hide internal directories.