Documentation
¶
Overview ¶
Package revolt contains types shared by the other packages.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var APIBaseURL = "https://api.revolt.chat"
APIBaseURL is the base URL of the API. Exported as a variable so clients can set a different URL for self-hosting.
Functions ¶
This section is empty.
Types ¶
type Attachment ¶
type Attachment struct { ID string `json:"_id"` Tag AttachmentTag `json:"tag"` Size uint64 `json:"size"` // Size in bytes Filename string `json:"filename"` Metadata AttachmentMetadata `json:"metadata"` ContentType string `json:"content_type"` }
Attachment is a message attachment.
type AttachmentMetadata ¶
type AttachmentMetadata struct { Type string `json:"type"` Width int `json:"width,omitempty"` Height int `json:"height,omitempty"` }
AttachmentMetadata ...
type AttachmentTag ¶
type AttachmentTag string
AttachmentTag is used in the Attachment struct.
const ( TagAttachments AttachmentTag = "attachments" TagAvatars AttachmentTag = "avatars" TagBackgrounds AttachmentTag = "backgrounds" TagBanners AttachmentTag = "banners" TagIcons AttachmentTag = "icons" )
Attachment tag constants. Not sure what these do?
type BotInformation ¶
type BotInformation struct {
OwnerID string `json:"owner"`
}
BotInformation ...
type Channel ¶
type Channel struct { ID string `json:"_id"` ServerID string `json:"server,omitempty"` Type string `json:"channel_type"` Name string `json:"name"` Icon *Attachment `json:"icon"` NSFW bool `json:"nsfw"` Description string `json:"description,omitempty"` LastMessageID string `json:"last_message_id"` // Only in groups Permissions uint64 `json:"permissions"` // Only in servers DefaultPermissions uint64 `json:"default_permissions"` RolePermissions map[string]uint64 `json:"role_permissions"` // If a DM, whether it's active DMActive bool `json:"active"` // If a group, the owner's ID GroupOwnerID string `json:"owner"` Recipients []string `json:"recipients"` }
Channel ...
type Message ¶
type Message struct { ID string `json:"_id"` Nonce string `json:"nonce,omitempty"` ChannelID string `json:"channel"` AuthorID string `json:"author"` // Not a string because the API can return one of 10(!) objects *or* a string! Beautiful. // To get message content, assuming it's a string, use the m.String() method; // To get a MessageContent object, use m.Object(). Content jsonutil.Raw `json:"content"` Attachments []Attachment `json:"attachments,omitempty"` }
Message is a Revolt message.
func (Message) Object ¶
func (m Message) Object() (c MessageContent, err error)
Object unmarshals m.Content to a MessageContent.
type MessageContent ¶
type MessageContent struct { Type string Content string `json:"content,omitempty"` Name string `json:"name,omitempty"` // User ID ID string `json:"id,omitempty"` // User ID? By string `json:"by,omitempty"` }
MessageContent is used for the Message.Content field, but only sometimes.
type Role ¶
type Role struct { Name string `json:"name"` Colour string `json:"colour"` Permissions [2]uint64 `json:"permissions"` Hoist bool `json:"hoist"` Rank uint `json:"rank"` }
Role ...
type Server ¶
type Server struct { ID string `json:"_id"` OwnerID string `json:"owner"` Name string `json:"name"` Description string `json:"description,omitempty"` Icon *Attachment `json:"icon,omitempty"` Banner *Attachment `json:"banner,omitempty"` Channels []string `json:"channels"` Categories []ServerCategory `json:"categories"` DefaultPermissions [2]uint64 `json:"default_permissions"` }
Server ...
type ServerCategory ¶
type ServerCategory struct { ID string `json:"id"` Title string `json:"title"` Channels []string `json:"channels"` }
ServerCategory ...
type ServerSystemMessages ¶
type ServerSystemMessages struct { UserJoined string `json:"user_joined"` UserLeft string `json:"user_left"` UserKicked string `json:"user_kicked"` UserBanned string `json:"user_banned"` }
ServerSystemMessages ...
type User ¶
type User struct { ID string `json:"_id"` Username string `json:"username"` Avatar *Attachment `json:"avatar"` Bot *BotInformation `json:"bot,omitempty"` Badges Badges `json:"badges"` Flags UserFlags `json:"flags"` Relations []Relation `json:"relations"` Relationship string `json:"relationship"` Status *Status `json:"status"` Online bool `json:"online"` }
User is a user.
Click to show internal directories.
Click to hide internal directories.