valour

package module
v0.0.0-...-370e725 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2026 License: ISC Imports: 27 Imported by: 0

README

Valour for Go

Important: This library is very early alpha. APIs may change without notice, features may be incomplete, and parts of the library may be broken.

valourgo provides a Go-friendly way to interact with the Valour API, as documented here:

https://app.valour.gg/swagger/index.html

The goal of this project is to make it easier to build bots, services, and integrations for Valour using Go, without having to manually manage HTTP requests and low-level API details.

Installation

go get github.com/auroradevllc/valourgo

(Module path may change during early development.)

Usage

A basic example bot is available at examples/bot/main.go

The example demonstrates:

  • Creating a client
  • Authenticating with Valour
  • Connecting the Realtime API (SignalR)

This is the best place to start to understand the intended usage of the SDK.

API Coverage

This SDK is based on the official Valour API:

https://app.valour.gg/swagger/index.html

Not all endpoints may be implemented yet.

Contributing

Issues, pull requests, and feedback are welcome, especially while the project is in its early stages.

Expect rough edges, refactors, and breaking changes.

License

A copy of the license is provided in LICENSE, and available here:

Copyright 2026 Aurora Development LLC

Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED “AS IS” AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

Documentation

Index

Constants

View Source
const (
	ClickTargetLink = 1 + iota
	ClickTargetPage
	ClickTargetEvent
	ClickTargetFormSubmit
)
View Source
const Epoch = 1610339820000 * time.Millisecond

Epoch timestamp is 01/11/2021 4:37:00 UTC

View Source
const (
	LatestMessageIndex = MessageID(9223372036854775807)
)

LatestMessageIndex is long.MaxValue in C#, this will return our latest messages only

View Source
const NullSnowflake = Snowflake(0)

Variables

View Source
var (
	ErrAlreadyOpen         = errors.New("connection already open")
	ErrInvalidResponseType = errors.New("invalid response type for request")
)
View Source
var ErrInvalidCount = errors.New("invalid message count")
View Source
var (
	ErrInvalidPing = errors.New("invalid ping response")
)

Functions

func Ref

func Ref[V any](v V) *V

Types

type BaseClient

type BaseClient struct {
	*Node
	// contains filtered or unexported fields
}

type BaseRTCResponse

type BaseRTCResponse struct {
	Success   bool    `json:"Success"`
	Message   *string `json:"Message"`
	ErrorCode *int    `json:"ErrorCode"`
}

type Channel

type Channel struct {
	ID             ChannelID       `json:"id"`
	PlanetID       PlanetID        `json:"planetId"`
	ParentID       ChannelID       `json:"parentId"`
	ChannelType    ChannelType     `json:"channelType"`
	Name           string          `json:"name"`
	Description    string          `json:"description"`
	InheritsPerms  bool            `json:"inheritsPerms"`
	IsDefault      bool            `json:"isDefault"`
	RawPosition    int64           `json:"rawPosition"`
	Position       ChannelPosition `json:"position"`
	LastUpdateTime time.Time       `json:"lastUpdateTime"`
}

type ChannelCurrentlyTypingUpdate

type ChannelCurrentlyTypingUpdate struct {
	PlanetID  PlanetID  `json:"planetId"`
	ChannelID ChannelID `json:"channelId"`
	UserID    UserID    `json:"userId"`
}

type ChannelID

type ChannelID Snowflake

func (ChannelID) IsValid

func (i ChannelID) IsValid() bool

func (ChannelID) String

func (i ChannelID) String() string

type ChannelPosition

type ChannelPosition struct {
	RawPosition   int64 `json:"rawPosition"`
	Depth         int   `json:"depth"`
	LocalPosition int   `json:"localPosition"`
}

type ChannelStateEvent

type ChannelStateEvent struct {
	ChannelID ChannelID `json:"channelId"`
	PlanetID  PlanetID  `json:"planetId"`
	Time      time.Time `json:"time"`
}

type ChannelType

type ChannelType int
const (
	PlanetChat ChannelType = iota
	PlanetCategory
	PlanetVoice

	DirectChat
	DirectVoice

	GroupChat
	GroupVoice
)

type ChannelWatchingUpdate

type ChannelWatchingUpdate struct {
	PlanetID  PlanetID  `json:"planetId"`
	ChannelID ChannelID `json:"channelId"`
	UserIDs   []UserID  `json:"userIds"`
}

type Clickable

type Clickable struct {
	ClickTarget any `json:"ClickTarget,omitempty"`
}

type Client

type Client interface {
	handler.HandlerInterface

	NodeName() (string, error)
	Version() (string, error)
	Open(ctx context.Context) error
	Connected() bool
	JoinAllChannels(ctx context.Context) error
	Close() error

	NodeForPlanet(planetID PlanetID) (*Node, error)
	GetNodeNameForPlanet(planetID PlanetID) (string, error)
	Planets() ([]Planet, error)
	Planet(id PlanetID) (*Planet, error)
	CreatePlanet(planet CreatePlanetData) (*Planet, error)
	UpdatePlanet(id PlanetID, data EditPlanetData) (*Planet, error)
	DeletePlanet(id PlanetID) error
	PlanetInitialData(id PlanetID) (*PlanetInitialData, error)
	JoinPlanet(planet PlanetID, inviteCode string) error

	Channels(id PlanetID) ([]Channel, error)

	Me() (*User, error)
	MyMember(planetID PlanetID) (*Member, error)
	Member(id MemberID) (*Member, error)
	MemberByUser(planetID PlanetID, id UserID) (*Member, error)
}

func NewClient

func NewClient(token string, opts ...Option) (Client, error)

type CreatePlanetData

type CreatePlanetData struct {
	Name         string  `json:"name"`
	Description  *string `json:"description"`
	Public       bool    `json:"public"`
	Discoverable bool    `json:"discoverable"`
	NSFW         bool    `json:"nsfw"`
}

type EditMessageData

type EditMessageData struct {
	ID       MessageID `json:"id"`
	PlanetID PlanetID  `json:"planetId"`
	Content  *string   `json:"content"`
	Embed    *Embed    `json:"-"`
}

func (EditMessageData) MarshalJSON

func (e EditMessageData) MarshalJSON() ([]byte, error)

MarshalJSON marshals necessary options of a message send This serializes Embed and Attachments

type EditPlanetData

type EditPlanetData struct {
	Name         string  `json:"name"`
	Description  *string `json:"description"`
	Public       bool    `json:"public"`
	Discoverable bool    `json:"discoverable"`
	NSFW         bool    `json:"nsfw"`
	Tags         []Tag   `json:"tags"`
}

type Embed

type Embed struct {
	Id                   *string     `json:"Id"`
	Name                 *string     `json:"Name"`
	StartPage            int         `json:"StartPage"`
	HideChangePageArrows bool        `json:"HideChangePageArrows"`
	Version              string      `json:"EmbedVersion"`
	Pages                []EmbedPage `json:"Pages"`
}

func NewEmbed

func NewEmbed(opts ...EmbedOption) *Embed

NewEmbed is recommended instead of creating Embeds directly as it sets some defaults

type EmbedButton

type EmbedButton struct {
	Clickable
	Children []EmbedItem `json:"Children"`
}

func (EmbedButton) MarshalJSON

func (e EmbedButton) MarshalJSON() ([]byte, error)

func (EmbedButton) Type

func (e EmbedButton) Type() EmbedItemType

type EmbedEventTarget

type EmbedEventTarget struct {
	EventElementID string `json:"e"`
}

func (EmbedEventTarget) MarshalJSON

func (e EmbedEventTarget) MarshalJSON() ([]byte, error)

type EmbedFormSubmitTarget

type EmbedFormSubmitTarget struct {
	EventElementID string `json:"e"`
}

func (EmbedFormSubmitTarget) MarshalJSON

func (e EmbedFormSubmitTarget) MarshalJSON() ([]byte, error)

type EmbedItem

type EmbedItem interface {
	Type() EmbedItemType
}

type EmbedItemType

type EmbedItemType int
const (
	EmbedTypeItem EmbedItemType = 1 + iota
	EmbedTypeText
	EmbedTypeButton
	EmbedTypeInputBox
	EmbedTypeTextArea
	EmbedTypeProgressBar
	EmbedTypeForm
	EmbedTypeGoTo
	EmbedTypeDropDownItem
	EmbedTypeDropDownMenu
	EmbedTypeEmbedRow
	EmbedTypeEmbedPage
	EmbedTypeProgress
	EmbedTypeMedia
)

type EmbedLinkTarget

type EmbedLinkTarget struct {
	Href string `json:"h"`
}

func (EmbedLinkTarget) MarshalJSON

func (e EmbedLinkTarget) MarshalJSON() ([]byte, error)

type EmbedOption

type EmbedOption func(e *Embed)

func WithEmbedID

func WithEmbedID(id string) EmbedOption

func WithEmbedName

func WithEmbedName(name string) EmbedOption

func WithEmbedPages

func WithEmbedPages(pages ...EmbedPage) EmbedOption

func WithEmbedStartPage

func WithEmbedStartPage(page int) EmbedOption

type EmbedPage

type EmbedPage struct {
	Children []EmbedItem `json:"Children"`
	Title    string      `json:"Title"`
	Footer   string      `json:"Footer"`
}

func (EmbedPage) MarshalJSON

func (e EmbedPage) MarshalJSON() ([]byte, error)

func (EmbedPage) Type

func (e EmbedPage) Type() EmbedItemType

type EmbedPageTarget

type EmbedPageTarget struct {
	Page int `json:"p"`
}

func (EmbedPageTarget) MarshalJSON

func (e EmbedPageTarget) MarshalJSON() ([]byte, error)

type EmbedRow

type EmbedRow struct {
	Children []EmbedItem
}

func (EmbedRow) MarshalJSON

func (e EmbedRow) MarshalJSON() ([]byte, error)

func (EmbedRow) Type

func (e EmbedRow) Type() EmbedItemType

type EmbedText

type EmbedText struct {
	Clickable
	Text string `json:"Text"`
}

func (EmbedText) MarshalJSON

func (e EmbedText) MarshalJSON() ([]byte, error)

func (EmbedText) Type

func (e EmbedText) Type() EmbedItemType

type Emoji

type Emoji struct {
	ID            EmojiID   `json:"id"`
	CreatorUserID UserID    `json:"creatorUserId"`
	Name          string    `json:"name"`
	CreatedAt     time.Time `json:"createdAt"`
}

type EmojiID

type EmojiID Snowflake

func (EmojiID) IsValid

func (i EmojiID) IsValid() bool

func (EmojiID) String

func (i EmojiID) String() string

type Member

type Member struct {
	ID       MemberID `json:"id"`
	User     User     `json:"user"`
	UserID   UserID   `json:"userId"`
	PlanetID PlanetID `json:"planetId"`
	Nickname *string  `json:"nickname"`
	Avatar   *string  `json:"memberAvatar"`
}

type MemberID

type MemberID Snowflake

func (MemberID) IsValid

func (i MemberID) IsValid() bool

func (MemberID) String

func (i MemberID) String() string

type Message

type Message struct {
	ID              MessageID           `json:"id"`
	PlanetID        PlanetID            `json:"planetId"`
	ChannelID       ChannelID           `json:"channelId"`
	ReplyToID       *UserID             `json:"replyToId"`
	ReplyTo         *Message            `json:"replyTo"`
	AuthorID        UserID              `json:"authorUserId"`
	MemberID        MemberID            `json:"authorMemberId"`
	Content         string              `json:"content"`
	TimeSent        time.Time           `json:"timeSent"`
	EditedTime      *time.Time          `json:"editedTime"`
	Fingerprint     string              `json:"fingerprint"`
	Reactions       []Reaction          `json:"reactions"`
	Attachments     []MessageAttachment `json:"attachments"`
	AttachmentsData string              `json:"attachmentsData"`
}

type MessageAttachment

type MessageAttachment struct {
	Location string                `json:"Location"`
	MimeType string                `json:"MimeType"`
	FileName string                `json:"FileName"`
	Width    int                   `json:"Width"`
	Height   int                   `json:"Height"`
	Inline   bool                  `json:"Inline"`
	Type     MessageAttachmentType `json:"Type"`
}

type MessageAttachmentType

type MessageAttachmentType int
const (
	AttachmentTypeImage MessageAttachmentType = iota
	AttachmentTypeVideo
	AttachmentTypeAudio
	AttachmentTypeFile

	// Future embedded attachments for Valour functions
	AttachmentTypeValourMessage
	AttachmentTypeValourInvite
	AttachmentTypeValourPlanet
	AttachmentTypeValourChannel
	AttachmentTypeValourItem
	AttachmentTypeValourEcoAccount
	AttachmentTypeValourEcoTrade
	AttachmentTypeValourReceipt
	AttachmentTypeValourBot

	// Generic link preview using Open Graph
	AttachmentTypeSitePreview

	// Video platforms
	AttachmentTypeYouTube
	AttachmentTypeVimeo
	AttachmentTypeTwitch
	AttachmentTypeTikTok

	// Social platforms
	AttachmentTypeTwitter
	AttachmentTypeReddit
	AttachmentTypeInstagram
	AttachmentTypeBluesky

	// Music platforms
	AttachmentTypeSpotify
	AttachmentTypeSoundCloud

	// Developer platforms
	AttachmentTypeGitHub
)

type MessageCreateEvent

type MessageCreateEvent struct {
	Message
}

type MessageDeleteEvent

type MessageDeleteEvent struct {
	Message
}

type MessageEditEvent

type MessageEditEvent struct {
	Message
}

type MessageID

type MessageID Snowflake

func (MessageID) IsValid

func (i MessageID) IsValid() bool

func (MessageID) Route

func (i MessageID) Route(path ...string) string

func (MessageID) String

func (i MessageID) String() string

type MessageReactionAddedEvent

type MessageReactionAddedEvent struct {
	MessageReactionEvent
}

type MessageReactionEvent

type MessageReactionEvent struct {
	MessageID MessageID `json:"messageId"`
	UserID    UserID    `json:"authorUserId"`
	MemberID  MemberID  `json:"authorMemberId"`
	Emoji     string    `json:"emoji"`
}

type MessageReactionRemovedEvent

type MessageReactionRemovedEvent struct {
	MessageReactionEvent
}

type Node

type Node struct {
	*handler.Handler

	Name    string
	Primary *Node
	// contains filtered or unexported fields
}

func NewNode

func NewNode(baseAddress, name, token string, opts ...NodeOption) (*Node, error)

func (*Node) Channels

func (n *Node) Channels(id PlanetID) ([]Channel, error)

Channels gets a planet's channels

func (*Node) Close

func (n *Node) Close() error

Close will close any open rtc connections. If this is called on the primary node, all child nodes will also be closed.

func (*Node) Connected

func (n *Node) Connected() bool

Connected checks whether the node is connected to SignalR

func (*Node) CreatePlanet

func (n *Node) CreatePlanet(planet CreatePlanetData) (*Planet, error)

CreatePlanet will create a new planet This request always goes to the primary node

func (*Node) DeleteMessage

func (n *Node) DeleteMessage(id MessageID) error

DeleteMessage deletes a message

func (*Node) DeletePlanet

func (n *Node) DeletePlanet(id PlanetID) error

DeletePlanet will delete a planet

func (*Node) DeleteRole

func (n *Node) DeleteRole(planetID PlanetID, roleID RoleID) error

func (*Node) EditMessage

func (n *Node) EditMessage(id MessageID, m EditMessageData) (*Message, error)

EditMessage updates a message

func (*Node) GetNodeNameForPlanet

func (n *Node) GetNodeNameForPlanet(planetID PlanetID) (string, error)

GetNodeNameForPlanet retrieves the node name for the specified planet

func (*Node) IsPrimary

func (n *Node) IsPrimary() bool

IsPrimary checks whether a node is the primary Valour node

func (*Node) JoinAllChannels

func (n *Node) JoinAllChannels(ctx context.Context) error

JoinAllChannels will join all channels the account has access to. This will always be called on the primary node.

func (*Node) JoinPlanet

func (n *Node) JoinPlanet(planet PlanetID, inviteCode string) error

JoinPlanet allows you to join a planet, with optional invite code

func (*Node) Me

func (n *Node) Me() (*User, error)

func (*Node) Member

func (n *Node) Member(id MemberID) (*Member, error)

func (*Node) MemberByUser

func (n *Node) MemberByUser(planetID PlanetID, id UserID) (*Member, error)

func (*Node) Message

func (n *Node) Message(id MessageID) (*Message, error)

Message retrieves a single message

func (*Node) MessageReactionAdd

func (n *Node) MessageReactionAdd(id MessageID, emoji string) error

MessageReactionAdd adds a reaction to a message

func (*Node) MessageReactionRemove

func (n *Node) MessageReactionRemove(id MessageID, emoji string) error

MessageReactionRemove removes a reaction from a message

func (*Node) Messages

func (n *Node) Messages(planetID PlanetID, channelID ChannelID, limit uint) ([]Message, error)

Messages retrieves the latest x messages

func (*Node) MessagesBefore

func (n *Node) MessagesBefore(planetID PlanetID, channelID ChannelID, index MessageID, limit uint) ([]Message, error)

MessagesBefore retrieves messages before a specific message

func (*Node) MyMember

func (n *Node) MyMember(planetID PlanetID) (*Member, error)

func (*Node) NodeForPlanet

func (n *Node) NodeForPlanet(planetID PlanetID) (*Node, error)

func (*Node) NodeName

func (n *Node) NodeName() (string, error)

NodeName requests the current node name from the API, guaranteeing an accurate result This shouldn't be needed, Node.Name should be plenty for everyday use.

func (*Node) Open

func (n *Node) Open(ctx context.Context) error

Open will open a signalr websocket to the server for real-time events

func (*Node) Planet

func (n *Node) Planet(id PlanetID) (*Planet, error)

Planet retrieves a planet by a specified ID This request always goes to the primary node

func (*Node) PlanetInitialData

func (n *Node) PlanetInitialData(id PlanetID) (*PlanetInitialData, error)

PlanetInitialData retrieves initial data for a planet, such as channels, roles, and emojis

func (*Node) Planets

func (n *Node) Planets() ([]Planet, error)

Planets returns the user's planets This request always goes to the primary node

func (*Node) Role

func (n *Node) Role(planetID PlanetID, roleID RoleID) (*Role, error)

func (*Node) SendMessage

func (n *Node) SendMessage(planetID PlanetID, channelID ChannelID, content string) (*Message, error)

SendMessage sends a simple text message

func (*Node) SendMessageComplex

func (n *Node) SendMessageComplex(planetID PlanetID, channelID ChannelID, send SendMessageData) (*Message, error)

SendMessageComplex sends a message with optional text, attachments, and embeds

func (*Node) UpdatePlanet

func (n *Node) UpdatePlanet(id PlanetID, data EditPlanetData) (*Planet, error)

UpdatePlanet will update an existing planet with the specified data This request always goes to the primary node

func (*Node) UpdateRole

func (n *Node) UpdateRole(planetID PlanetID, role Role) (*Role, error)

func (*Node) UploadFile

func (n *Node) UploadFile(fileName string, r io.Reader, size int64) (*MessageAttachment, error)

UploadFile uploads a file to Valour

func (*Node) UploadImage

func (n *Node) UploadImage(fileName string, r io.Reader, size int64) (*MessageAttachment, error)

UploadImage uploads an image to Valour

func (*Node) Version

func (n *Node) Version() (string, error)

Version requests the current server version

type NodeOption

type NodeOption func(*Node)

func WithNodeHandler

func WithNodeHandler(h *handler.Handler) NodeOption

type Option

type Option func(c *BaseClient)

func WithBaseURL

func WithBaseURL(baseURL string) Option

type Planet

type Planet struct {
	ID                  PlanetID `json:"id"`
	OwnerID             UserID   `json:"ownerId"`
	Name                string   `json:"name"`
	NodeName            string   `json:"nodeName"`
	HasCustomIcon       bool     `json:"hasCustomIcon"`
	HasAnimatedIcon     bool     `json:"hasAnimatedIcon"`
	Description         string   `json:"description"`
	Public              bool     `json:"public"`
	Discoverable        bool     `json:"discoverable"`
	NSFW                bool     `json:"nsfw"`
	Version             int      `json:"version"`
	HasCustomBackground bool     `json:"hasCustomBackground"`
	Tags                []Tag    `json:"tags"`
}

Planet is Valour's representation of a server/group

type PlanetDeleteEvent

type PlanetDeleteEvent struct {
	PlanetID PlanetID
}

type PlanetID

type PlanetID Snowflake

func (PlanetID) IsValid

func (i PlanetID) IsValid() bool

func (PlanetID) Route

func (i PlanetID) Route(path ...string) string

func (PlanetID) String

func (i PlanetID) String() string

type PlanetInitialData

type PlanetInitialData struct {
	Channels []Channel `json:"channels"`
	Roles    []Role    `json:"roles"`
	Emojis   []Emoji   `json:"emojis"`
}

PlanetInitialData contains planet data

type PlanetJoinEvent

type PlanetJoinEvent struct {
	PlanetID PlanetID
}

PlanetJoinEvent is called when RTC "joins" a planet for updates

type PlanetMemberDelete

type PlanetMemberDelete struct {
	Member
}

type PlanetMemberUpdate

type PlanetMemberUpdate struct {
	Member
}

type PlanetUpdateEvent

type PlanetUpdateEvent struct {
	Planet
}

type RTC

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

func ConnectRTC

func ConnectRTC(ctx context.Context, name, address string, handler handler.HandlerInterface) (*RTC, error)

func (*RTC) Authorize

func (r *RTC) Authorize(token string) error

Authorize sends our token to the SignalR hub, used as authentication

func (*RTC) Close

func (r *RTC) Close() error

Close will close the signalr client

func (*RTC) JoinChannel

func (r *RTC) JoinChannel(channel ChannelID) error

JoinChannel subscribes to the channel's updates/messages

func (*RTC) JoinPlanet

func (r *RTC) JoinPlanet(planet PlanetID) error

JoinPlanet will subscribe to the planet channel to receive updates for a planet

func (*RTC) JoinUser

func (r *RTC) JoinUser() error

JoinUser will join the user update channel

func (*RTC) LeaveChannel

func (r *RTC) LeaveChannel(channel ChannelID) error

LeaveChannel unsubscribes from channel updates/messages

func (*RTC) LeavePlanet

func (r *RTC) LeavePlanet(planet PlanetID) error

LeavePlanet removes our subscription to the planet channel

func (*RTC) Ping

func (r *RTC) Ping() error

Ping sends a ping request to the SignalR hub

func (*RTC) Start

func (r *RTC) Start()

Start simply starts the ping ticker, sent every 60 seconds

func (*RTC) State

func (r *RTC) State() RTCState

State returns our current state

type RTCAuthResponse

type RTCAuthResponse struct {
	BaseRTCResponse
}

type RTCError

type RTCError struct {
	ErrorCode *int
	Message   *string
}

func (RTCError) Error

func (e RTCError) Error() string

type RTCState

type RTCState int
const (
	RTCStateUnknown RTCState = iota
	RTCStateConnected
	RTCStateUnauthorized
	RTCStateAuthorized
)

type Reaction

type Reaction struct {
	ID             int64     `json:"id"`
	Emoji          string    `json:"emoji"`
	MessageID      MessageID `json:"messageId"`
	AuthorUserID   UserID    `json:"authorUserId"`
	AuthorMemberID MemberID  `json:"authorMemberId"`
	CreatedAt      time.Time `json:"createdAt"`
}

type Role

type Role struct {
	ID                  RoleID   `json:"id"`
	PlanetID            PlanetID `json:"planetId"`
	Name                string   `json:"name"`
	Position            int      `json:"position"`
	IsDefault           bool     `json:"isDefault"`
	Permissions         int64    `json:"permissions"`
	ChatPermissions     int      `json:"chatPermissions"`
	CategoryPermissions int      `json:"categoryPermissions"`
	VoicePermissions    int      `json:"voicePermissions"`
	Color               string   `json:"color"`
	Bold                bool     `json:"bold"`
	Italics             bool     `json:"italics"`
	FlagBitIndex        int      `json:"flagBitIndex"`
	AnyoneCanMention    bool     `json:"anyoneCanMention"`
	IsAdmin             bool     `json:"isAdmin"`
}

type RoleID

type RoleID Snowflake

func (RoleID) IsValid

func (i RoleID) IsValid() bool

func (RoleID) String

func (i RoleID) String() string

type SendMessageData

type SendMessageData struct {
	AuthorMemberID MemberID             `json:"authorMemberId"`
	PlanetID       PlanetID             `json:"planetId"`
	ChannelID      ChannelID            `json:"channelId"`
	ReplyToID      *MessageID           `json:"replyToId"`
	Content        string               `json:"content"`
	Attachments    []*MessageAttachment `json:"attachments,omitempty"`
	Embed          *Embed               `json:"-"`
	Fingerprint    string               `json:"fingerprint"`
}

func (SendMessageData) MarshalJSON

func (s SendMessageData) MarshalJSON() ([]byte, error)

MarshalJSON marshals necessary options of a message send This serializes Embed and Attachments

type Snowflake

type Snowflake uint64

func ParseSnowflake

func ParseSnowflake(in string) (Snowflake, error)

func (Snowflake) Generator

func (i Snowflake) Generator() uint16

func (Snowflake) IsValid

func (i Snowflake) IsValid() bool

func (Snowflake) Sequence

func (i Snowflake) Sequence() uint8

func (Snowflake) String

func (i Snowflake) String() string

func (Snowflake) Time

func (i Snowflake) Time() time.Time

type Tag

type Tag struct {
	ID      int64  `json:"id"`
	Name    string `json:"name"`
	Created Time   `json:"created"`
	Slug    string `json:"slug"`
}

type TargetType

type TargetType int

type Time

type Time struct {
	time.Time
}

func (*Time) UnmarshalJSON

func (t *Time) UnmarshalJSON(b []byte) error

type User

type User struct {
	HasCustomAvatar   bool        `json:"hasCustomAvatar"`
	HasAnimatedAvatar bool        `json:"hasAnimatedAvatar"`
	TimeJoined        time.Time   `json:"timeJoined"`
	Name              string      `json:"name"`
	Tag               string      `json:"tag"`
	Bot               bool        `json:"bot"`
	Disabled          bool        `json:"disabled"`
	ValourStaff       bool        `json:"valourStaff"`
	Status            *string     `json:"status"`
	UserStateCode     int         `json:"userStateCode"`
	TimeLastActive    time.Time   `json:"timeLastActive"`
	IsMobile          bool        `json:"isMobile"`
	Compliance        bool        `json:"compliance"`
	SubscriptionType  string      `json:"subscriptionType"`
	PriorName         string      `json:"priorName"`
	NameChangeTime    time.Time   `json:"nameChangeTime"`
	Version           int         `json:"version"`
	TutorialState     int         `json:"tutorialState"`
	OwnerId           interface{} `json:"ownerId"`
	NameAndTag        string      `json:"nameAndTag"`
	ID                UserID      `json:"id"`
}

type UserID

type UserID Snowflake

func (UserID) IsValid

func (i UserID) IsValid() bool

func (UserID) String

func (i UserID) String() string

type UserUpdateEvent

type UserUpdateEvent struct {
	User
}

Directories

Path Synopsis
examples
bot command

Jump to

Keyboard shortcuts

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