Documentation ¶
Index ¶
- Constants
- func GenerateNonce() string
- type ApiResponse
- type Category
- type Channel
- type Client
- func (client *Client) Close()
- func (client *Client) OnMessage(handler func(*Client, *Message))
- func (client *Client) OnMessageUpdate(handler func(*Client, *MessageUpdate))
- func (client *Client) OnReady(handler func(*Client, *Ready))
- func (client *Client) Open() error
- func (client *Client) Request(method string, route string, data []byte) ([]byte, error)
- func (client *Client) SendMessage(channel string, message *Message) (*Message, error)
- func (client *Client) SendMessageContent(channel string, message string) (*Message, error)
- type Context
- type Embed
- type EmbedImage
- type EmbedSpecial
- type EmbedVideo
- type File
- type FileMetadata
- type Message
- type MessageUpdate
- type OverrideField
- type Ping
- type Ready
- type Role
- type Server
- type SystemMessages
- type User
- type UserBot
- type UserRelationship
- type UserStatus
Constants ¶
View Source
const API_URL = "https://api.revolt.chat"
View Source
const PING_INTERVAL = 15
Variables ¶
This section is empty.
Functions ¶
func GenerateNonce ¶
func GenerateNonce() string
Types ¶
type ApiResponse ¶
type ApiResponse struct {
Type string `json:"type"`
}
type Channel ¶
type Channel struct { Id string `json:"_id"` ChannelType string `json:"channel_type"` User string `json:"user"` Name string `json:"name"` Active bool `json:"active"` Recipients []string `json:"recipients"` LastMessageId string `json:"last_message_id"` Owner string `json:"owner"` Description string `json:"description"` Icon File `json:"icon"` Permissions int `json:"permissions"` Nsfw bool `json:"nsfw"` DefaultPermissions OverrideField `json:"default_permissions"` RolePermissions map[string]OverrideField `json:"role_permissions"` }
This is a confusing one because the Type key is used to differeniate instead of separate objects so the fields are as follows:
SavedMessages : Id, User DirectMessages: Id, Active, Recipients, LastMessageId Group : Id, Name, Owner, Description, Recipients, Icon, LastMessageId, Nsfw, TextChannel : Id, Server, Name, Description, Icon, LastMessageId, DefaultPermissions, RolePermissions, Nsfw VoiceCHannel : Id, Server, Name, Description, Icon, DefaultPermissions, RolePermissions, Nsfw
If anyone has ideas to improve this please feel free to make a PR
type Client ¶
type Client struct { Token string // contains filtered or unexported fields }
func (*Client) OnMessageUpdate ¶
func (client *Client) OnMessageUpdate(handler func(*Client, *MessageUpdate))
func (*Client) SendMessage ¶
type Embed ¶
type Embed struct { Type string `json:"type"` Url string `json:"url"` OriginalUrl string `json:"original_url"` Special EmbedSpecial `json:"special"` Title string `json:"title"` Description string `json:"description"` Image EmbedImage `json:"image"` Video EmbedVideo `json:"video"` SiteName string `json:"site_name"` IconUrl string `json:"icon_url"` Colour string `json:"colour"` }
type EmbedImage ¶
type EmbedSpecial ¶
type EmbedVideo ¶
type FileMetadata ¶
type MessageUpdate ¶
type OverrideField ¶
type Ping ¶
type Ping struct { ApiResponse Data int `json:"data"` }
type Role ¶
type Role struct { Name string `json:"name"` Permissions OverrideField `json:"permissions"` Colour string `json:"colour"` Hoist bool `json:"hoist"` Rank int `json:"rank"` }
type Server ¶
type Server struct { Id string `json:"_id"` Owner string `json:"owner"` Name string `json:"name"` Description string `json:"description"` Channels []string `json:"channels"` Categories []Category `json:"categories"` SystemMessages SystemMessages `json:"system_messages"` Roles map[string]Role `json:"roles"` DefaultPermissions int `json:"default_permissions"` Icon File `json:"file"` Banner File `json:"banner"` Nsfw bool `json:"nsfw"` Flags int `json:"flags"` }
type SystemMessages ¶
type User ¶
type User struct { Id string `json:"_id"` Username string `json:"username"` Avatar File `json:"avatar"` Badges int `json:"badges"` Status UserStatus `json:"status"` Relationship UserRelationship `json:"relationship"` Online bool `json:"online"` Privileged bool `json:"privileged"` Flags int `json:"flags"` Bot UserBot `json:"bot"` }
type UserRelationship ¶
type UserStatus ¶
Click to show internal directories.
Click to hide internal directories.