divolt

package
v1.1.17 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2023 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SlavartBotStatusOnline  = "online"
	SlavartBotStatusOffline = "offline"
)

Variables

View Source
var (
	SlavartAllowedHosts = []string{
		"tidal.com",
		"www.qobuz.com",
		"play.qobuz.com",
		"open.qobuz.com",
		"soundcloud.com",
		"www.deezer.com",
		"open.spotify.com",
		"music.youtube.com",
		"www.jiosaavn.com",
	}
)

Functions

This section is empty.

Types

type Login

type Login struct {
	Result string `json:"result"`
	Id     string `json:"_id"`
	UserId string `json:"user_id"`
	Token  string `json:"token"`
	Name   string `json:"name"`
}

type Message

type Message struct {
	Id      string `json:"_id"`
	Nonce   string `json:"nonce"`
	Channel string `json:"channel"`
	Author  string `json:"author"`
	Webhook struct {
		Name   string `json:"name"`
		Avatar string `json:"avatar"`
	} `json:"webhook"`
	Content string `json:"content"`
	System  struct {
		Type    string `json:"type"`
		Content string `json:"content"`
	} `json:"system"`
	Attachments []struct {
		Id       string `json:"_id"`
		Tag      string `json:"tag"`
		Filename string `json:"filename"`
		Metadata struct {
			Type string `json:"type"`
		} `json:"metadata"`
		ContentType string `json:"content_type"`
		Size        int    `json:"size"`
		Deleted     bool   `json:"deleted"`
		Reported    bool   `json:"reported"`
		MessageId   string `json:"message_id"`
		UserId      string `json:"user_id"`
		ServerId    string `json:"server_id"`
		ObjectId    string `json:"object_id"`
	} `json:"attachments"`
	Edited time.Time `json:"edited"`
	Embeds []struct {
		Type        string `json:"type"`
		URL         string `json:"url"`
		OriginalUrl string `json:"original_url"`
		Special     struct {
			Type string `json:"type"`
		} `json:"special"`
		Title       string `json:"title"`
		Description string `json:"description"`
		Image       struct {
			Url    string `json:"url"`
			Width  int    `json:"width"`
			Height int    `json:"height"`
			Size   string `json:"size"`
		} `json:"image"`
		Video struct {
			Url    string `json:"url"`
			Width  int    `json:"width"`
			Height int    `json:"height"`
		} `json:"video"`
		SiteName string `json:"site_name"`
		IconUrl  string `json:"icon_url"`
		Colour   string `json:"colour"`
	} `json:"embeds"`
	Mentions     []string            `json:"mentions"`
	Replies      []string            `json:"replies"`
	Reactions    map[string][]string `json:"reactions"`
	Interactions struct {
		Reactions         []string `json:"reactions"`
		RestrictReactions bool     `json:"restrict_reactions"`
	} `json:"interactions"`
	Masquerade struct {
		Name   string `json:"name"`
		Avatar string `json:"avatar"`
		Colour string `json:"colour"`
	} `json:"masquerade"`
}

type Session

type Session struct {
	// contains filtered or unexported fields
}

func (*Session) AuthenticateWithCredentials

func (s *Session) AuthenticateWithCredentials(email, password string) error

func (*Session) AuthenticateWithSessionToken

func (s *Session) AuthenticateWithSessionToken(sessionToken string) error

func (*Session) AuthenticatedRequest

func (s *Session) AuthenticatedRequest(method, endpoint string, body *bytes.Buffer, result any) error

func (*Session) GetAuthenticatedUserInfo

func (s *Session) GetAuthenticatedUserInfo() (*User, error)

func (*Session) Logout

func (s *Session) Logout() error

func (*Session) OpenAuthenticatedSocket

func (s *Session) OpenAuthenticatedSocket() (*Socket, error)

func (*Session) SendMessage

func (s *Session) SendMessage(channelId, message string) (*Message, error)

func (*Session) SlavartGetBotStatus

func (s *Session) SlavartGetBotStatus() (string, error)

func (*Session) SlavartGetUploadUrl

func (s *Session) SlavartGetUploadUrl(downloadMessageId, requestUrl string, timeout time.Duration) (string, error)

func (*Session) SlavartSendDownloadCommand

func (s *Session) SlavartSendDownloadCommand(url string, quality int) (*Message, error)

func (*Session) SlavartTryInviteUser

func (s *Session) SlavartTryInviteUser() error

func (*Session) UnauthenticatedRequest

func (s *Session) UnauthenticatedRequest(method, endpoint string, body *bytes.Buffer, result any) error

type Socket

type Socket struct {
	// contains filtered or unexported fields
}

func (*Socket) Close

func (s *Socket) Close() error

func (*Socket) DeregisterMessageChannel

func (s *Socket) DeregisterMessageChannel(channel *chan SocketResponse)

func (*Socket) RegisterMessageChannel

func (s *Socket) RegisterMessageChannel(channel *chan SocketResponse)

func (*Socket) StartListening

func (s *Socket) StartListening()

type SocketMessage

type SocketMessage struct {
	Type string `json:"type"`
	Message
}

type SocketMessageUpdate

type SocketMessageUpdate struct {
	Type    string  `json:"type"`
	Id      string  `json:"id"`
	Channel string  `json:"channel"`
	Data    Message `json:"data"`
}

type SocketResponse

type SocketResponse struct {
	Type string `json:"type"`
	Data []byte `json:"data"`
}

type User

type User struct {
	Id            string `json:"_id"`
	Username      string `json:"username"`
	Discriminator string `json:"discriminator"`
	DisplayName   string `json:"display_name"`
	Avatar        struct {
		Id       string `json:"_id"`
		Tag      string `json:"tag"`
		Filename string `json:"filename"`
		Metadata struct {
			Type string `json:"type"`
		} `json:"metadata"`
		ContentType string `json:"content_type"`
		Size        int    `json:"size"`
		Deleted     bool   `json:"deleted"`
		Reported    bool   `json:"reported"`
		MessageId   string `json:"message_id"`
		UserId      string `json:"user_id"`
		ServerId    string `json:"server_id"`
		ObjectId    string `json:"object_id"`
	} `json:"avatar"`
	Relations []struct {
		Id     string `json:"_id"`
		Status string `json:"status"`
	} `json:"relations"`
	Badges int `json:"badges"`
	Status struct {
		Text     string `json:"text"`
		Presence string `json:"presence"`
	} `json:"status"`
	Profile struct {
		Content    string `json:"content"`
		Background struct {
			Id       string `json:"_id"`
			Tag      string `json:"tag"`
			Filename string `json:"filename"`
			Metadata struct {
				Type string `json:"type"`
			} `json:"metadata"`
			ContentType string `json:"content_type"`
			Size        int    `json:"size"`
			Deleted     bool   `json:"deleted"`
			Reported    bool   `json:"reported"`
			MessageId   string `json:"message_id"`
			UserId      string `json:"user_id"`
			ServerId    string `json:"server_id"`
			ObjectId    string `json:"object_id"`
		} `json:"background"`
	} `json:"profile"`
	Flags      int  `json:"flags"`
	Privileged bool `json:"privileged"`
	Bot        struct {
		Owner string `json:"owner"`
	} `json:"bot"`
	Relationship string `json:"relationship"`
	Online       bool   `json:"online"`
}

Jump to

Keyboard shortcuts

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