Documentation
¶
Overview ¶
Package revoltgo is a Go wrapper for the Revolt API with low-level bindings - Made by @sentinelb51 - For support, join our revolt server on the GitHub README file
Index ¶
- Constants
- func EndpointAuthAccount(action string) string
- func EndpointAuthAccountChange(detail string) string
- func EndpointAuthAccountVerify(code string) string
- func EndpointAuthSession(action string) string
- func EndpointAutumn(tag string) (url string)
- func EndpointAutumnFile(tag, id, size string) (url string)
- func EndpointBots(bID string) string
- func EndpointBotsInvite(bID string) string
- func EndpointChannelAckMessage(cID, mID string) string
- func EndpointChannels(cID string) string
- func EndpointChannelsInvite(cID, iID string) string
- func EndpointChannelsInvites(cID string) string
- func EndpointChannelsMessage(cID, mID string) string
- func EndpointChannelsMessageReaction(cID, mID, rID string) string
- func EndpointChannelsMessageReactions(cID, mID string) string
- func EndpointChannelsMessages(cID string) string
- func EndpointChannelsPermissions(sID, cID string) string
- func EndpointChannelsRecipients(cID, mID string) string
- func EndpointChannelsTyping(cID string) string
- func EndpointChannelsWebhooks(cID string) string
- func EndpointCustomEmoji(eID string) string
- func EndpointInvite(sID string) string
- func EndpointOnboard(action string) string
- func EndpointPush(action string) string
- func EndpointServerPermissions(sID, rID string) string
- func EndpointServers(sID string) string
- func EndpointServersAck(sID string) string
- func EndpointServersBan(sID, uID string) string
- func EndpointServersBans(sID string) string
- func EndpointServersChannels(sID string) string
- func EndpointServersMember(sID, mID string) string
- func EndpointServersMembers(sID string) string
- func EndpointServersRole(sID, rID string) string
- func EndpointServersRoles(sID string) string
- func EndpointSync(setting string) string
- func EndpointSyncSettings(sID string) string
- func EndpointUsers(uID string) string
- func EndpointUsersBlock(uID string) string
- func EndpointUsersDM(uID string) string
- func EndpointUsersDefaultAvatar(uID string) string
- func EndpointUsersFlags(uID string) string
- func EndpointUsersFriend(uID string) string
- func EndpointUsersMutual(uID string) string
- func EndpointUsersProfile(uID string) string
- func NewWithLogin(data LoginData) (*Session, LoginResponse, error)
- func Ptr[T any](v T) *T
- func SetBaseURL(newURL string) error
- type AbstractEventUpdate
- func (aeu *AbstractEventUpdate) EventChannelUpdate() *EventChannelUpdate
- func (aeu *AbstractEventUpdate) EventMessageUpdate() *EventMessageUpdate
- func (aeu *AbstractEventUpdate) EventServerMemberUpdate() *EventServerMemberUpdate
- func (aeu *AbstractEventUpdate) EventServerRoleUpdate() *EventServerRoleUpdate
- func (aeu *AbstractEventUpdate) EventServerUpdate() *EventServerUpdate
- func (aeu *AbstractEventUpdate) EventUserUpdate() *EventUserUpdate
- func (aeu *AbstractEventUpdate) EventWebhookUpdate() *EventWebhookUpdate
- type AbstractEventUpdateID
- type Account
- type AccountChangeEmailData
- type AccountChangePasswordData
- type AccountCreateData
- type AccountDeleteConfirmData
- type AccountReverifyData
- type Attachment
- type AttachmentMetadata
- type AttachmentMetadataType
- type AuthType
- type Bot
- type BotCreateData
- type BotEditData
- type BotInformation
- type BotInviteData
- type ChangeEmail
- type Channel
- type ChannelEditData
- type ChannelFetchedMessages
- type ChannelMessageBulkDeleteData
- type ChannelMessagesParams
- type ChannelMessagesParamsSortType
- type ChannelType
- type CompositeChannelID
- type Emoji
- type EmojiCreateData
- type EmojiParent
- type Event
- type EventAuth
- type EventAuthenticated
- type EventBulk
- type EventBulkMessageDelete
- type EventChannelAck
- type EventChannelCreate
- type EventChannelDelete
- type EventChannelGroupJoin
- type EventChannelGroupLeave
- type EventChannelStartTyping
- type EventChannelStopTyping
- type EventChannelUpdate
- type EventEmojiCreate
- type EventEmojiDelete
- type EventError
- type EventErrorType
- type EventMessage
- type EventMessageAppend
- type EventMessageDelete
- type EventMessageReact
- type EventMessageRemoveReaction
- type EventMessageUnreact
- type EventMessageUpdate
- type EventPong
- type EventReady
- type EventServerCreate
- type EventServerDelete
- type EventServerMemberJoin
- type EventServerMemberLeave
- type EventServerMemberUpdate
- type EventServerRoleDelete
- type EventServerRoleUpdate
- type EventServerUpdate
- type EventUserPlatformWipe
- type EventUserRelationship
- type EventUserSettingsUpdate
- type EventUserUpdate
- type EventWebhookCreate
- type EventWebhookDelete
- type EventWebhookUpdate
- type FetchedBot
- type FetchedBots
- type FetchedGroupMembers
- type File
- type FileAttachment
- type Group
- type GroupCreateData
- type GroupSystemMessages
- type Invite
- type InviteCreate
- type InviteJoin
- type InviteType
- type LoginData
- type LoginResponse
- type MFA
- type MFAResponse
- type MemberCompositeID
- type Message
- type MessageEditData
- type MessageEdited
- type MessageEmbed
- type MessageEmbedImage
- type MessageEmbedSpecial
- type MessageEmbedSpecialType
- type MessageEmbedVideo
- type MessageInteractions
- type MessageMasquerade
- type MessageReplies
- type MessageSend
- type MessageSystem
- type MessageSystemType
- type MessageWebhook
- type MutualFriendsAndServersResponse
- type Onboarding
- type OnboardingCompleteData
- type PasswordResetConfirmData
- type PermissionAD
- type PermissionsSetDefaultData
- type PublicBot
- type Ratelimiter
- type RootData
- type Server
- type ServerBan
- type ServerBans
- type ServerCategory
- type ServerChannelCreateData
- type ServerChannelCreateDataType
- type ServerCreateData
- type ServerEditData
- type ServerEditDataRemove
- type ServerMember
- type ServerMemberEditData
- type ServerMembers
- type ServerRole
- type ServerRoleCreateData
- type ServerRoleEditData
- type ServerSystemMessages
- type Session
- func (s *Session) Account() (account *Account, err error)
- func (s *Session) AccountChangeEmail(data AccountChangeEmailData) error
- func (s *Session) AccountChangePassword(data AccountChangePasswordData) error
- func (s *Session) AccountCreate(data AccountCreateData) error
- func (s *Session) AccountDelete() error
- func (s *Session) AccountDeleteConfirm(data AccountDeleteConfirmData) error
- func (s *Session) AccountDisable() error
- func (s *Session) AccountReverify(data AccountReverifyData) error
- func (s *Session) AddHandler(handler any)
- func (s *Session) AttachmentUpload(file *File) (attachment *FileAttachment, err error)
- func (s *Session) Bot(bID string) (bot *FetchedBot, err error)
- func (s *Session) BotCreate(data BotCreateData) (bot *Bot, err error)
- func (s *Session) BotDelete(bID string) error
- func (s *Session) BotEdit(id string, data BotEditData) (bot *Bot, err error)
- func (s *Session) BotInvite(bID string, data BotInviteData) (err error)
- func (s *Session) BotPublic(bID string) (bot *PublicBot, err error)
- func (s *Session) Bots() (bots *FetchedBots, err error)
- func (s *Session) Channel(cID string) (channel *Channel, err error)
- func (s *Session) ChannelBeginTyping(cID string) (err error)
- func (s *Session) ChannelDelete(cID string) (err error)
- func (s *Session) ChannelEdit(cID string, data ChannelEditData) (channel *Channel, err error)
- func (s *Session) ChannelEndTyping(cID string) (err error)
- func (s *Session) ChannelInviteCreate(cID string) (invite *InviteCreate, err error)
- func (s *Session) ChannelMessage(cID, mID string) (message *Message, err error)
- func (s *Session) ChannelMessageDelete(cID, mID string) error
- func (s *Session) ChannelMessageDeleteBulk(cID string, messages ChannelMessageBulkDeleteData) error
- func (s *Session) ChannelMessageEdit(cID, mID string, data MessageEditData) (message *Message, err error)
- func (s *Session) ChannelMessageReactionClear(cID, mID string) (err error)
- func (s *Session) ChannelMessageReactionCreate(cID, mID, eID string) (err error)
- func (s *Session) ChannelMessageReactionDelete(cID, mID, eID string) (err error)
- func (s *Session) ChannelMessageSend(cID string, data MessageSend) (message *Message, err error)
- func (s *Session) ChannelMessages(cID string, params ...ChannelMessagesParams) (messages []*Message, err error)
- func (s *Session) ChannelPermissionsSet(sID, cID string, data PermissionAD) (err error)
- func (s *Session) ChannelPermissionsSetDefault(sID string, data PermissionAD) (err error)
- func (s *Session) ChannelWebhooks(cID string) (webhooks []*Webhook, err error)
- func (s *Session) ChannelWebhooksCreate(cID string, data WebhookCreate) (webhook *Webhook, err error)
- func (s *Session) Close() error
- func (s *Session) DirectMessageCreate(uID string) (channel *Channel, err error)
- func (s *Session) DirectMessages() (channels []*Channel, err error)
- func (s *Session) Emoji(eID string) (emoji *Emoji, err error)
- func (s *Session) EmojiCreate(eID string, data EmojiCreateData) (emoji *Emoji, err error)
- func (s *Session) EmojiDelete(eID string) error
- func (s *Session) FriendAdd(username string) (user *User, err error)
- func (s *Session) FriendDelete(username string) (user *User, err error)
- func (s *Session) GroupCreate(data GroupCreateData) (group *Group, err error)
- func (s *Session) GroupMemberAdd(cID, mID string) (err error)
- func (s *Session) GroupMemberDelete(cID, mID string) (err error)
- func (s *Session) GroupMembers(cID string) (users []*User, err error)
- func (s *Session) Invite(iID string) (invite *Invite, err error)
- func (s *Session) InviteDelete(iID string) (err error)
- func (s *Session) InviteJoin(iID string) (invite *Invite, err error)
- func (s *Session) Latency() time.Duration
- func (s *Session) Login(data LoginData) (mfa LoginResponse, err error)
- func (s *Session) Logout() error
- func (s *Session) MessageAck(channelID, messageID string) (err error)
- func (s *Session) Onboarding() (onboarding Onboarding, err error)
- func (s *Session) OnboardingComplete(data OnboardingCompleteData) error
- func (s *Session) Open() (err error)
- func (s *Session) PasswordReset(data AccountReverifyData) error
- func (s *Session) PasswordResetConfirm(data PasswordResetConfirmData) error
- func (s *Session) PermissionsSet(sID, rID string, data PermissionAD) (err error)
- func (s *Session) PermissionsSetDefault(sID string, data PermissionsSetDefaultData) (err error)
- func (s *Session) PushSubscribe(data WebpushSubscription) error
- func (s *Session) PushUnsubscribe(data WebpushSubscription) error
- func (s *Session) Relationships() (relationships []*UserRelations, err error)
- func (s *Session) Request(method, destination string, data, result any) error
- func (s *Session) Selfbot() bool
- func (s *Session) Server(id string) (server *Server, err error)
- func (s *Session) ServerAck(serverID string) (err error)
- func (s *Session) ServerBans(sID string) (bans []*ServerBans, err error)
- func (s *Session) ServerChannelCreate(sID string, data ServerChannelCreateData) (channel *Channel, err error)
- func (s *Session) ServerCreate(data ServerCreateData) (server *Server, err error)
- func (s *Session) ServerDelete(sID string) error
- func (s *Session) ServerEdit(id string, data ServerEditData) (server *Server, err error)
- func (s *Session) ServerMember(sID, mID string) (member *ServerMember, err error)
- func (s *Session) ServerMemberBan(sID, mID string) (err error)
- func (s *Session) ServerMemberDelete(sID, mID string) (err error)
- func (s *Session) ServerMemberEdit(sID, mID string, data ServerMemberEditData) (member *ServerMember, err error)
- func (s *Session) ServerMemberUnban(sID, mID string) (err error)
- func (s *Session) ServerMembers(sID string) (members *ServerMembers, err error)
- func (s *Session) ServerRoleDelete(sID, rID string) (err error)
- func (s *Session) ServersRole(sID, rID string) (role *ServerRole, err error)
- func (s *Session) ServersRoleCreate(sID string, data ServerRoleCreateData) (role *ServerRole, err error)
- func (s *Session) ServersRoleEdit(sID, rID string, data ServerRoleEditData) (role *ServerRole, err error)
- func (s *Session) SessionEdit(id string, data SessionEditData) (session SessionEditData, err error)
- func (s *Session) Sessions() (sessions []*Sessions, err error)
- func (s *Session) SessionsDelete(id string) error
- func (s *Session) SessionsDeleteAll(revokeSelf bool) error
- func (s *Session) SetUsername(data UsernameData) (user *User, err error)
- func (s *Session) SyncSettingsFetch(payload SyncSettingsFetchData) (data *SyncSettingsData, err error)
- func (s *Session) SyncSettingsSet(payload SyncSettingsData) error
- func (s *Session) SyncUnreads() (data []SyncUnread, err error)
- func (s *Session) Uptime() time.Duration
- func (s *Session) User(uID string) (user *User, err error)
- func (s *Session) UserBlock(uID string) (user *User, err error)
- func (s *Session) UserDefaultAvatar(uID string) (binary []byte, err error)
- func (s *Session) UserEdit(uID string, data UserEditData) (user *User, err error)
- func (s *Session) UserFlags(uID string) (flags int, err error)
- func (s *Session) UserMutual(uID string) (mutual []*MutualFriendsAndServersResponse, err error)
- func (s *Session) UserProfile(uID string) (profile *UserProfile, err error)
- func (s *Session) UserUnblock(uID string) (user *User, err error)
- func (s *Session) VerifyEmail(code string) (ticket ChangeEmail, err error)
- func (s *Session) WriteSocket(data any) error
- type SessionEditData
- type Sessions
- type State
- func (s *State) Channel(id string) *Channel
- func (s *State) ChannelPermissions(user *User, channel *Channel) (uint, error)
- func (s *State) Emoji(id string) *Emoji
- func (s *State) Member(uID, sID string) *ServerMember
- func (s *State) Members(sID string) []*ServerMember
- func (s *State) Role(sID, rID string) *ServerRole
- func (s *State) Self() *User
- func (s *State) Server(id string) *Server
- func (s *State) ServerPermissions(user *User, server *Server) (uint, error)
- func (s *State) TrackAPICalls() bool
- func (s *State) TrackBulkAPICalls() bool
- func (s *State) TrackChannels() bool
- func (s *State) TrackEmojis() bool
- func (s *State) TrackMembers() bool
- func (s *State) TrackServers() bool
- func (s *State) TrackUsers() bool
- func (s *State) TrackWebhooks() bool
- func (s *State) User(id string) *User
- func (s *State) Webhook(id string) *Webhook
- type SyncSettingsData
- type SyncSettingsFetchData
- type SyncUnread
- type Ticket
- type UpdateTuple
- type User
- type UserEditData
- type UserProfile
- type UserRelations
- type UserRelationshipType
- type UserSettings
- type UserStatus
- type UserStatusPresence
- type UsernameData
- type Webhook
- type WebhookCreate
- type WebpushSubscription
- type WebsocketChannelTyping
- type WebsocketMessageAuthenticate
- type WebsocketMessagePing
- type WebsocketMessageType
Constants ¶
const ( URLUsersUsername = "/users/me/username" URLUsers = "/users/%s" URLUsersMutual = URLUsers + "/mutual" URLUsersDM = URLUsers + "/dm" URLUsersFlags = URLUsers + "/flags" URLUsersFriend = URLUsers + "/friend" URLUsersBlock = URLUsers + "/block" URLUsersProfile = URLUsers + "/profile" URLUsersRelationships = URLUsers + "/relationships" URLUsersDefaultAvatar = URLUsers + "/default_avatar" URLServers = "/servers/%s" URLServersAck = URLServers + "/ack" URLServersChannels = URLServers + "/channels" URLServersMembers = URLServers + "/members" URLServersMember = URLServersMembers + "/%s" URLServersBans = URLServers + "/bans" URLServersBan = URLServersBans + "/%s" URLServersRoles = URLServers + "/roles" URLServersRole = URLServers + "/roles/%s" URLServersPermissions = URLServers + "/permissions/%s" URLChannels = "/channels/%s" URLChannelsAckMessage = URLChannels + "/ack/%s" URLChannelsMessages = URLChannels + "/messages" URLChannelsMessage = URLChannelsMessages + "/%s" URLChannelsMessageReactions = URLChannelsMessage + "/reactions" URLChannelsMessageReaction = URLChannelsMessageReactions + "/%s" URLChannelsTyping = URLChannels + "/typing" URLChannelsInvites = URLChannels + "/invites" URLChannelsInvite = URLChannelsInvites + "/%s" URLChannelsPermissions = URLChannels + "/permissions/%s" URLChannelsRecipients = URLChannels + "/recipients/%s" URLChannelsWebhooks = URLChannels + "/webhooks" URLInvites = "/invites/%s" URLBots = "/bots/%s" URLBotsInvite = URLBots + "/invite" URLAuth = "/auth" URLAuthAccount = URLAuth + "/account/%s" URLAuthSessions = URLAuth + "/session/%s" URLCustom = "/custom" URLCustomEmoji = URLCustom + "/emoji/%s" URLOnboard = "/onboard/%s" URLSync = "/sync/%s" URLPush = "/push/%s" URLSafetyReport = "/safety/report" )
const ( MessageEmbedSpecialTypeNone = "None" MessageEmbedSpecialTypeGIF = "GIF" MessageEmbedSpecialTypeYouTube = "YouTube" MessageEmbedSpecialTypeLightspeed = "Lightspeed" MessageEmbedSpecialTypeTwitch = "Twitch" MessageEmbedSpecialTypeSpotify = "Spotify" MessageEmbedSpecialTypeSoundcloud = "Soundcloud" MessageEmbedSpecialTypeBandcamp = "Bandcamp" MessageEmbedSpecialTypeStreamable = "Streamable" )
const ( UserPermissionAccess = 1 << iota UserPermissionViewProfile UserPermissionSendMessage UserPermissionInvite )
const ( PermissionManageChannel = 2 << 0 PermissionManageServer = 2 << 1 PermissionManagePermissions = 2 << 2 PermissionManageRole = 2 << 3 PermissionManageCustomisation = 2 << 4 PermissionKickMembers = 2 << 6 PermissionBanMembers = 2 << 7 PermissionTimeoutMembers = 2 << 8 PermissionAssignRoles = 2 << 9 PermissionChangeNickname = 2 << 10 PermissionManageNicknames = 2 << 11 PermissionChangeAvatar = 2 << 12 PermissionRemoveAvatars = 2 << 13 PermissionViewChannel = 2 << 20 PermissionReadMessageHistory = 2 << 21 PermissionSendMessage = 2 << 22 PermissionManageMessages = 2 << 23 PermissionManageWebhooks = 2 << 24 PermissionInviteOthers = 2 << 25 PermissionSendEmbeds = 2 << 26 PermissionUploadFiles = 2 << 27 PermissionMasquerade = 2 << 28 PermissionReact = 2 << 29 PermissionConnect = 2 << 30 PermissionSpeak = 2 << 31 PermissionVideo = 2 << 32 PermissionMuteMembers = 2 << 33 PermissionDeafenMembers = 2 << 34 PermissionMoveMembers = 2 << 35 PermissionGrantAllSafe = 0x000F_FFFF_FFFF_FFFF )
const ( PermissionPresetTimeout = PermissionViewChannel + PermissionReadMessageHistory PermissionPresetViewOnly = PermissionViewChannel + PermissionReadMessageHistory PermissionPresetDefault = PermissionPresetViewOnly + PermissionSendMessage + PermissionInviteOthers + PermissionSendEmbeds + PermissionUploadFiles + PermissionConnect + PermissionSpeak PermissionPresetDM = PermissionPresetDefault + PermissionReact + PermissionManageChannel )
const ( UserRelationsTypeNone = "None" UserRelationsTypeUser = "User" UserRelationsTypeFriend = "Friend" UserRelationsTypeOutgoing = "Outgoing" UserRelationsTypeIncoming = "Incoming" UserRelationsTypeBlocked = "Blocked" UserRelationsTypeBlockedOther = "BlockedOther" )
const VERSION = "v2.4.0"
Variables ¶
This section is empty.
Functions ¶
func EndpointAuthAccount ¶
func EndpointAuthSession ¶
func EndpointAutumn ¶
func EndpointAutumnFile ¶
func EndpointBots ¶
func EndpointBotsInvite ¶
func EndpointChannels ¶
func EndpointChannelsInvite ¶
func EndpointChannelsInvites ¶
func EndpointChannelsMessage ¶
func EndpointChannelsTyping ¶
func EndpointCustomEmoji ¶
func EndpointInvite ¶
func EndpointOnboard ¶
func EndpointPush ¶
func EndpointServers ¶
func EndpointServersAck ¶
func EndpointServersBan ¶
func EndpointServersBans ¶
func EndpointServersChannels ¶
func EndpointServersMember ¶
func EndpointServersMembers ¶
func EndpointServersRole ¶
func EndpointServersRoles ¶
func EndpointSync ¶
func EndpointSyncSettings ¶
func EndpointUsers ¶
func EndpointUsersBlock ¶
func EndpointUsersDM ¶
func EndpointUsersFlags ¶
func EndpointUsersFriend ¶
func EndpointUsersMutual ¶
func EndpointUsersProfile ¶
func NewWithLogin ¶
func NewWithLogin(data LoginData) (*Session, LoginResponse, error)
NewWithLogin exchanges an email and password for a session token, and then creates a new session. You are expected to store and re-use the token for future sessions.
func Ptr ¶
func Ptr[T any](v T) *T
Ptr is a quality-of-life function to quickly return a pointer to any value
func SetBaseURL ¶
SetBaseURL sets the base URL for the API. Make sure to call this before opening any sessions, and not during an active connection.
Types ¶
type AbstractEventUpdate ¶
type AbstractEventUpdate struct { Event // ID can either be a simple string or a MemberCompositeID. ID AbstractEventUpdateID `json:"id"` // RoleID is only present in ServerRoleUpdate events. RoleID string `json:"role_id"` // The updated data for a specific event Data json.RawMessage `json:"data"` // Clear is a list of keys to clear from the cache. Clear []string `json:"clear"` // Remove is a list of keys to remove from the cache. // Ideally the API should just stick to "clear"... Remove []string `json:"remove"` }
AbstractEventUpdate is a generic event for all update events. This is mainly used to update the cache, and is not a low-level event.
func (*AbstractEventUpdate) EventChannelUpdate ¶
func (aeu *AbstractEventUpdate) EventChannelUpdate() *EventChannelUpdate
func (*AbstractEventUpdate) EventMessageUpdate ¶
func (aeu *AbstractEventUpdate) EventMessageUpdate() *EventMessageUpdate
func (*AbstractEventUpdate) EventServerMemberUpdate ¶
func (aeu *AbstractEventUpdate) EventServerMemberUpdate() *EventServerMemberUpdate
func (*AbstractEventUpdate) EventServerRoleUpdate ¶
func (aeu *AbstractEventUpdate) EventServerRoleUpdate() *EventServerRoleUpdate
func (*AbstractEventUpdate) EventServerUpdate ¶
func (aeu *AbstractEventUpdate) EventServerUpdate() *EventServerUpdate
func (*AbstractEventUpdate) EventUserUpdate ¶
func (aeu *AbstractEventUpdate) EventUserUpdate() *EventUserUpdate
func (*AbstractEventUpdate) EventWebhookUpdate ¶
func (aeu *AbstractEventUpdate) EventWebhookUpdate() *EventWebhookUpdate
type AbstractEventUpdateID ¶
type AbstractEventUpdateID struct { StringID string MemberID MemberCompositeID }
func (*AbstractEventUpdateID) UnmarshalJSON ¶
func (id *AbstractEventUpdateID) UnmarshalJSON(data []byte) (err error)
type AccountChangeEmailData ¶
type AccountCreateData ¶
type AccountDeleteConfirmData ¶
type AccountDeleteConfirmData struct {
Token string `json:"token"`
}
type AccountReverifyData ¶
type Attachment ¶
type Attachment struct { ID string `json:"_id"` // Tag / bucket this file was uploaded to Tag string `json:"tag"` // Original filename Filename string `json:"filename"` // Metadata associated with file Metadata *AttachmentMetadata `json:"metadata"` // Raw content type of this file ContentType string `json:"content_type"` // Size of this file (in bytes) Size int `json:"size"` // Whether this file was deleted Deleted bool `json:"deleted"` // Whether this file was reported Reported bool `json:"reported"` MessageID string `json:"message_id"` UserID string `json:"user_id"` ServerID string `json:"server_id"` ObjectID string `json:"object_id"` }
func (Attachment) URL ¶
func (a Attachment) URL(size string) string
type AttachmentMetadata ¶
type AttachmentMetadata struct { Type AttachmentMetadataType `json:"type"` Width int `json:"width"` Height int `json:"height"` }
type AttachmentMetadataType ¶
type AttachmentMetadataType string
const ( AttachmentMetadataTypeFile AttachmentMetadataType = "File" AttachmentMetadataTypeText AttachmentMetadataType = "Text" AttachmentMetadataTypeImage AttachmentMetadataType = "Image" AttachmentMetadataTypeVideo AttachmentMetadataType = "Video" AttachmentMetadataTypeAudio AttachmentMetadataType = "Audio" )
type Bot ¶
type Bot struct { ID string `json:"_id"` // User ID of the bot owner Owner string `json:"owner"` // Token used to authenticate requests for this bot Token string `json:"token"` // Whether the bot is public (may be invited by anyone) Public bool `json:"public"` // Whether to enable analytics Analytics bool `json:"analytics"` // Whether this bot should be publicly discoverable Discoverable bool `json:"discoverable"` // Reserved; URL for handling interactions InteractionsURL string `json:"interactions_url"` // URL for terms of service TermsOfServiceURL string `json:"terms_of_service_url"` // URL for privacy policy PrivacyPolicyURL string `json:"privacy_policy_url"` // Enum of bot flags Flags int `json:"flags"` }
type BotCreateData ¶
type BotCreateData struct {
Name string `json:"name"`
}
type BotEditData ¶
type BotInformation ¶
type BotInformation struct {
Owner string `json:"owner"`
}
type BotInviteData ¶
type ChangeEmail ¶
type ChangeEmail struct {
Ticket Ticket `json:"ticket"` // Why is this nested
}
type Channel ¶
type Channel struct { ID string `json:"_id"` Server string `json:"server"` ChannelType ChannelType `json:"channel_type"` Name string `json:"name"` Description string `json:"description"` Icon *Attachment `json:"icon"` DefaultPermissions *PermissionAD `json:"default_permissions"` NSFW bool `json:"nsfw"` // Recipients are populated for direct messages or groups, typically including your user ID Recipients []string `json:"recipients"` // ID of the last message sent in this channel LastMessageID string `json:"last_message_id"` // RolePermissions is a map of role ID to PermissionAD structs. RolePermissions map[string]*PermissionAD `json:"role_permissions"` // Permissions assigned to members of this group (does not apply to the owner of the group) Permissions *uint `json:"permissions"` // User ID of the owner of the group Owner string `json:"owner"` // Whether this direct message channel is currently open on both sides Active bool `json:"active"` }
Channel holds information about a channel.
type ChannelEditData ¶
type ChannelFetchedMessages ¶
type ChannelFetchedMessages struct { Messages []*Message `json:"messages"` Users []*User `json:"users"` Members []*ServerMember `json:"members"` }
type ChannelMessageBulkDeleteData ¶
type ChannelMessageBulkDeleteData struct {
IDs []string `json:"ids"`
}
type ChannelMessagesParams ¶
type ChannelMessagesParams struct { // Maximum number of messages to fetch. For nearby messages, this is (limit + 1) Limit int `json:"limit,omitempty"` // Message ID before which messages should be fetched Before string `json:"before,omitempty"` // Message ID after which messages should be fetched After string `json:"after,omitempty"` // Message sort direction Sort ChannelMessagesParamsSortType `json:"sort,omitempty"` // Message ID to search around. Specifying this ignores Before, After, and Sort Nearby string `json:"nearby,omitempty"` // Whether to include user (and member, if server channel) objects IncludeUsers bool `json:"include_users,omitempty"` }
func (ChannelMessagesParams) Encode ¶
func (p ChannelMessagesParams) Encode() string
type ChannelMessagesParamsSortType ¶
type ChannelMessagesParamsSortType string
const ( ChannelMessagesParamsSortTypeRelevance ChannelMessagesParamsSortType = "Relevance" ChannelMessagesParamsSortTypeOldest ChannelMessagesParamsSortType = "Oldest" ChannelMessagesParamsSortTypeLatest ChannelMessagesParamsSortType = "Latest" )
type ChannelType ¶
type ChannelType string
const ( ChannelTypeSavedMessages ChannelType = "SavedMessages" ChannelTypeText ChannelType = "TextChannel" ChannelTypeVoice ChannelType = "VoiceChannel" ChannelTypeDM ChannelType = "DirectMessage" ChannelTypeGroup ChannelType = "Group" )
type CompositeChannelID ¶
type EmojiCreateData ¶
type EmojiCreateData struct { Name string `json:"name"` Parent *EmojiParent `json:"parent"` Nsfw bool `json:"nsfw"` }
type EmojiParent ¶
type EventAuthenticated ¶
type EventAuthenticated struct {
Event
}
EventAuthenticated is sent after the client has authenticated.
type EventBulkMessageDelete ¶
type EventChannelAck ¶
type EventChannelCreate ¶
EventChannelCreate is sent when a channel is created. This is dispatched in conjunction with EventServerUpdate
type EventChannelDelete ¶
EventChannelDelete is sent when a channel is deleted.
type EventChannelGroupJoin ¶
type EventChannelGroupLeave ¶
type EventChannelGroupLeave struct {
EventChannelGroupJoin
}
type EventChannelStartTyping ¶
type EventChannelStartTyping struct { Event ID string `json:"id"` User string `json:"user,omitempty"` }
EventChannelStartTyping is sent when a user starts typing in a channel.
type EventChannelStopTyping ¶
type EventChannelStopTyping struct {
EventChannelStartTyping
}
EventChannelStopTyping is sent when a user stops typing in a channel.
type EventChannelUpdate ¶
type EventChannelUpdate struct { Event ID string `json:"id"` Data *Channel `json:"data"` Clear []string `json:"clear"` }
EventChannelUpdate is sent when a channel is updated. Data will only contain fields that were modified.
type EventEmojiCreate ¶
type EventEmojiDelete ¶
type EventError ¶
type EventError struct { Event // https://developers.revolt.chat/developers/events/protocol.html#error Error EventErrorType `json:"error"` }
type EventErrorType ¶
type EventErrorType string
const ( EventErrorTypeLabelMe EventErrorType = "LabelMe" EventErrorTypeInternalError EventErrorType = "InternalError" EventErrorTypeInvalidSession EventErrorType = "InvalidSession" EventErrorTypeOnboardingNotFinished EventErrorType = "OnboardingNotFinished" EventErrorTypeAlreadyAuthenticated EventErrorType = "AlreadyAuthenticated" )
type EventMessage ¶
type EventMessageAppend ¶
type EventMessageDelete ¶
type EventMessageReact ¶
type EventMessageRemoveReaction ¶
type EventMessageRemoveReaction struct { ID string `json:"id"` ChannelID string `json:"channel_id"` EmojiID string `json:"emoji_id"` }
EventMessageRemoveReaction is sent when all the reactions are removed from a message.
type EventMessageUnreact ¶
type EventMessageUnreact struct {
EventMessageReact
}
EventMessageUnreact is sent when a user removes a singular reaction from a message.
type EventMessageUpdate ¶
type EventReady ¶
type EventReady struct { Event Users []*User `json:"users"` Servers []*Server `json:"servers"` Channels []*Channel `json:"channels"` Members []*ServerMember `json:"members"` Emojis []*Emoji `json:"emojis"` }
EventReady provides information about objects relative to the user. This is used to populate the session's cache
type EventServerCreate ¶
type EventServerCreate struct { Event ID string `json:"id"` Server *Server `json:"server"` Channels []*Channel `json:"channels"` Emojis []*Emoji `json:"emojis"` }
EventServerCreate is sent when a server is created (joined).
type EventServerDelete ¶
type EventServerMemberJoin ¶
type EventServerMemberLeave ¶
type EventServerMemberLeave struct { Event ID string `json:"id"` User string `json:"user"` Reason string `json:"reason"` }
EventServerMemberLeave is sent when a user leaves a server.
type EventServerMemberUpdate ¶
type EventServerMemberUpdate struct { Event ID MemberCompositeID `json:"id"` Data *ServerMember `json:"data"` Clear []string `json:"clear"` }
EventServerMemberUpdate is sent when a member is updated. Data will only contain fields that were modified.
type EventServerRoleDelete ¶
type EventServerRoleUpdate ¶
type EventServerRoleUpdate struct { Event ID string `json:"id"` RoleID string `json:"role_id"` Data *ServerRole `json:"data"` Clear []string `json:"clear"` }
EventServerRoleUpdate is sent when a role is updated. Data will only contain fields that were modified.
type EventServerUpdate ¶
type EventServerUpdate struct { Event ID string `json:"id"` Data *Server `json:"data"` Clear []string `json:"clear"` }
EventServerUpdate is sent when a server is updated. Data will only contain fields that were modified.
type EventUserPlatformWipe ¶
type EventUserRelationship ¶
type EventUserSettingsUpdate ¶
type EventUserSettingsUpdate struct { Event // Update is a tuple of (int, string); update time, and the data in JSON Update map[string]UpdateTuple `json:"update"` }
type EventUserUpdate ¶
type EventWebhookCreate ¶
type EventWebhookDelete ¶
type EventWebhookUpdate ¶
type FetchedBot ¶
type FetchedBots ¶
type FetchedGroupMembers ¶
type FileAttachment ¶
type FileAttachment struct {
ID string `json:"id"`
}
FileAttachment is the response from the API when uploading a file. To upload a file, you must reference this ID in MessageSend.Attachments.
type GroupCreateData ¶
type GroupCreateData struct { Name string `json:"name"` Description string `json:"description,omitempty"` Users []string `json:"users"` NSFW bool `json:"nsfw"` }
GroupCreateData describes how a group should be created
type GroupSystemMessages ¶
type Invite ¶
type Invite struct { Type InviteType `json:"type"` ServerID string `json:"server_id"` ServerName string `json:"server_name"` ServerIcon *Attachment `json:"server_icon"` ServerBanner *Attachment `json:"server_banner"` ServerFlags uint32 `json:"server_flags"` ChannelID string `json:"channel_id"` ChannelName string `json:"channel_name"` ChannelDescription string `json:"channel_description"` UserName string `json:"user_name"` UserAvatar *Attachment `json:"user_avatar"` MemberCount uint64 `json:"member_count"` }
type InviteCreate ¶
type InviteCreate struct { Type InviteType `json:"type"` // ID is the code of the invite ID string `json:"_id"` Server string `json:"server"` Creator string `json:"creator"` Channel string `json:"channel"` }
InviteCreate seems deprecated/no longer documented todo: remove in the future
type InviteJoin ¶
type InviteJoin struct { Type InviteType `json:"type"` Channels []*Channel Server *Server `json:"server"` }
type InviteType ¶
type InviteType string
const ( InviteTypeServer InviteType = "Server" InviteTypeGroup InviteType = "Group" )
type LoginResponse ¶
type MFA ¶
type MFA struct { // Unvalidated or authorised MFA ticket; used to resolve the correct account MfaTicket string `json:"mfa_ticket"` // MFA response MfaResponse MFAResponse `json:"mfa_response"` // Friendly name used for the session FriendlyName string `json:"friendly_name"` }
type MFAResponse ¶
type MFAResponse struct {
Password string `json:"password"`
}
type MemberCompositeID ¶
func (MemberCompositeID) Mention ¶
func (m MemberCompositeID) Mention() string
type Message ¶
type Message struct { ID string `json:"_id"` Nonce string `json:"nonce"` Channel string `json:"channel"` Author string `json:"author"` Webhook *MessageWebhook `json:"webhook"` Content string `json:"content"` System *MessageSystem `json:"system"` Attachments []*Attachment `json:"attachments"` Edited time.Time `json:"edited"` Embeds []*MessageEmbed `json:"embeds"` Mentions []string `json:"mentions"` Replies []string `json:"replies"` // Map of emoji ID to array of user ID who reacted to it Reactions map[string][]string `json:"reactions"` Interactions *MessageInteractions `json:"interactions"` Masquerade *MessageMasquerade `json:"masquerade"` }
Message contains information about a message.
type MessageEditData ¶
type MessageEditData struct { Content string `json:"content,omitempty"` Embeds []*MessageEmbed `json:"embeds,omitempty"` }
type MessageEdited ¶
type MessageEdited struct {
Date int `json:"$date"`
}
type MessageEmbed ¶
type MessageEmbed struct { Type string `json:"type"` URL string `json:"url,omitempty"` OriginalURL string `json:"original_url,omitempty"` Special *MessageEmbedSpecial `json:"special,omitempty"` Title string `json:"title,omitempty"` Description string `json:"description,omitempty"` Image *MessageEmbedImage `json:"image,omitempty"` Video *MessageEmbedVideo `json:"video,omitempty"` SiteName string `json:"site_name,omitempty"` IconURL string `json:"icon_url,omitempty"` Colour string `json:"colour,omitempty"` }
type MessageEmbedImage ¶
type MessageEmbedSpecial ¶
type MessageEmbedSpecial struct { Type MessageEmbedSpecialType `json:"type"` ID string `json:"id"` Timestamp time.Time `json:"timestamp,omitempty"` // Identifies the type of content for types: Lightspeed, Twitch, Spotify, and Bandcamp ContentType string `json:"content_type"` }
type MessageEmbedSpecialType ¶
type MessageEmbedSpecialType string
type MessageEmbedVideo ¶
type MessageInteractions ¶
type MessageMasquerade ¶
type MessageReplies ¶
type MessageSend ¶
type MessageSend struct { Content string `json:"content"` Attachments []string `json:"attachments,omitempty"` Replies []*MessageReplies `json:"replies,omitempty"` Embeds []*MessageEmbed `json:"embeds,omitempty"` Masquerade *MessageMasquerade `json:"masquerade,omitempty"` Interactions *MessageInteractions `json:"interactions,omitempty"` }
MessageSend is used for sending messages to channels
type MessageSystem ¶
type MessageSystem struct { Type MessageSystemType `json:"type"` ID string `json:"id"` }
type MessageSystemType ¶
type MessageSystemType string
const ( MessageSystemTypeText MessageSystemType = "text" MessageSystemTypeUserAdded MessageSystemType = "user_added" MessageSystemTypeUserRemove MessageSystemType = "user_remove" MessageSystemTypeUserJoined MessageSystemType = "user_joined" MessageSystemTypeUserLeft MessageSystemType = "user_left" MessageSystemTypeUserKicked MessageSystemType = "user_kicked" MessageSystemTypeUserBanned MessageSystemType = "user_banned" MessageSystemTypeChannelRenamed MessageSystemType = "channel_renamed" MessageSystemTypeChannelDescriptionChanged MessageSystemType = "channel_description_changed" MessageSystemTypeChannelIconChanged MessageSystemType = "channel_icon_changed" MessageSystemTypeChannelOwnershipChanged MessageSystemType = "channel_ownership_changed" )
type MessageWebhook ¶
type Onboarding ¶
type Onboarding struct {
Onboarding bool `json:"onboarding"`
}
type OnboardingCompleteData ¶
type OnboardingCompleteData struct {
Username string `json:"username"`
}
type PermissionAD ¶
PermissionAD describes the default allowed and denied permissions
type PermissionsSetDefaultData ¶
type PermissionsSetDefaultData struct {
Permissions uint `json:"permissions"`
}
type PublicBot ¶
type PublicBot struct { ID string `json:"_id"` Username string `json:"username"` Avatar *Attachment `json:"avatar"` Description string `json:"description"` }
type Ratelimiter ¶
type Ratelimiter struct { sync.Mutex // Interval to clean-up stale ratelimit buckets. // Higher values will result in higher memory usage, but lower CPU, and vice versa. CleanInterval time.Duration // contains filtered or unexported fields }
Ratelimiter silently ensures that requests do not exceed the ratelimit set by Revolt
type RootData ¶
type RootData struct { Revolt string `json:"revolt"` Features struct { Captcha struct { Enabled bool `json:"enabled"` Key string `json:"key"` } `json:"captcha"` Email bool `json:"email"` InviteOnly bool `json:"invite_only"` Autumn struct { Enabled bool `json:"enabled"` URL string `json:"url"` } `json:"autumn"` January struct { Enabled bool `json:"enabled"` URL string `json:"url"` } `json:"january"` Voso struct { Enabled bool `json:"enabled"` URL string `json:"url"` WS string `json:"ws"` } `json:"voso"` } `json:"features"` WS string `json:"ws"` App string `json:"app"` VapID string `json:"vapid"` Build struct { CommitSha string `json:"commit_sha"` CommitTimestamp string `json:"commit_timestamp"` SemVer string `json:"semver"` OriginURL string `json:"origin_url"` Timestamp string `json:"timestamp"` } `json:"build"` }
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 []*ServerCategory `json:"categories"` SystemMessages ServerSystemMessages `json:"system_messages"` // Roles is a map of role ID to ServerRole structs. Roles map[string]*ServerRole `json:"roles"` DefaultPermissions *uint `json:"default_permissions"` Icon *Attachment `json:"icon"` Banner *Attachment `json:"banner"` Flags *uint `json:"flags"` NSFW *bool `json:"nsfw"` Analytics *bool `json:"analytics"` Discoverable *bool `json:"discoverable"` }
Server holds information about a server.
type ServerBan ¶
type ServerBan struct { ID MemberCompositeID `json:"_id"` Reason string `json:"reason"` }
type ServerBans ¶
type ServerCategory ¶
type ServerCategory struct { ID string `json:"id"` Title string `json:"title"` Channels []string `json:"channels"` }
ServerCategory Server categories struct.
type ServerChannelCreateData ¶
type ServerChannelCreateData struct { Type ServerChannelCreateDataType `json:"type"` Name string `json:"name"` Description string `json:"description,omitempty"` NSFW bool `json:"nsfw,omitempty"` }
type ServerChannelCreateDataType ¶
type ServerChannelCreateDataType string
const ( ServerChannelCreateDataTypeText ServerChannelCreateDataType = "Text" ServerChannelCreateDataTypeVoice ServerChannelCreateDataType = "Voice" )
type ServerCreateData ¶
type ServerEditData ¶
type ServerEditData struct { Name string `json:"name,omitempty"` Description string `json:"description,omitempty"` Icon string `json:"icon,omitempty"` Banner string `json:"banner,omitempty"` Categories []*ServerCategory `json:"categories,omitempty"` SystemMessages *ServerSystemMessages `json:"system_messages,omitempty"` Flags int `json:"flags,omitempty"` Discoverable *bool `json:"discoverable,omitempty"` Analytics *bool `json:"analytics,omitempty"` Remove []ServerEditDataRemove `json:"remove"` }
type ServerEditDataRemove ¶
type ServerEditDataRemove string
const ( ServerEditDataRemoveIcon ServerEditDataRemove = "Icon" ServerEditDataRemoveBanner ServerEditDataRemove = "Banner" ServerEditDataRemoveCategories ServerEditDataRemove = "Categories" ServerEditDataRemoveDescription ServerEditDataRemove = "Description" ServerEditDataRemoveSystemMessages ServerEditDataRemove = "SystemMessages" )
type ServerMember ¶
type ServerMember struct { ID MemberCompositeID `json:"_id"` JoinedAt time.Time `json:"joined_at"` Nickname *string `json:"nickname"` Avatar *Attachment `json:"avatar"` Roles []string `json:"roles"` Timeout *time.Time `json:"timeout"` }
func (ServerMember) Mention ¶
func (m ServerMember) Mention() string
Mention is a proxy function that calls ServerMember.ID.Mention().
type ServerMemberEditData ¶
type ServerMembers ¶
type ServerMembers struct { Members []*ServerMember `json:"members"` Users []*User `json:"users"` }
type ServerRole ¶
type ServerRole struct { Name string `json:"name"` Permissions *PermissionAD `json:"permissions"` Colour string `json:"colour"` Hoist bool `json:"hoist"` Rank int `json:"rank"` }
type ServerRoleCreateData ¶
type ServerRoleEditData ¶
type ServerSystemMessages ¶
type ServerSystemMessages struct { UserJoined string `json:"user_joined,omitempty"` UserLeft string `json:"user_left,omitempty"` UserKicked string `json:"user_kicked,omitempty"` UserBanned string `json:"user_banned,omitempty"` }
ServerSystemMessages System messages struct.
type Session ¶
type Session struct { // Authorisation token Token string // The websocket connection Socket *gws.Conn // HTTP client used for the REST API HTTP *http.Client // Ratelimiter for the REST API Ratelimiter *Ratelimiter // State is a central store for all data received from the API State *State // The user agent used for REST APIs UserAgent string // Indicates whether the websocket is connected Connected bool // Whether the websocket should reconnect when the connection drops ShouldReconnect bool // Defines a custom compression algorithm for the websocket // By default, compression is enabled at the fastest level (1) for >=512 byte payloads // To enable, set gws.PermessageDeflate.Enabled true CustomCompression *gws.PermessageDeflate // Interval between sending heartbeats. Lower values update the latency faster // Values too high (~100 seconds) may cause Cloudflare to drop the connection HeartbeatInterval time.Duration // Heartbeat counter HeartbeatCount int64 // Interval between reconnecting, if connection fails ReconnectInterval time.Duration // Last time a ping was sent LastHeartbeatSent time.Time // Last time a ping was received LastHeartbeatAck time.Time // contains filtered or unexported fields }
Session represents a connection to the Revolt API.
func (*Session) AccountChangeEmail ¶
func (s *Session) AccountChangeEmail(data AccountChangeEmailData) error
func (*Session) AccountChangePassword ¶
func (s *Session) AccountChangePassword(data AccountChangePasswordData) error
func (*Session) AccountCreate ¶
func (s *Session) AccountCreate(data AccountCreateData) error
func (*Session) AccountDelete ¶
func (*Session) AccountDeleteConfirm ¶
func (s *Session) AccountDeleteConfirm(data AccountDeleteConfirmData) error
func (*Session) AccountDisable ¶
func (*Session) AccountReverify ¶
func (s *Session) AccountReverify(data AccountReverifyData) error
func (*Session) AddHandler ¶
AddHandler registers an event handler based on function signature
func (*Session) AttachmentUpload ¶
func (s *Session) AttachmentUpload(file *File) (attachment *FileAttachment, err error)
func (*Session) Bot ¶
func (s *Session) Bot(bID string) (bot *FetchedBot, err error)
Bot fetches details of a bot you own by its ID
func (*Session) BotCreate ¶
func (s *Session) BotCreate(data BotCreateData) (bot *Bot, err error)
BotCreate creates a bot based on the data provided
func (*Session) BotEdit ¶
func (s *Session) BotEdit(id string, data BotEditData) (bot *Bot, err error)
func (*Session) BotInvite ¶
func (s *Session) BotInvite(bID string, data BotInviteData) (err error)
BotInvite invites a bot by its ID to a server or group
func (*Session) Bots ¶
func (s *Session) Bots() (bots *FetchedBots, err error)
Bots returns a list of bots for the current user
func (*Session) ChannelBeginTyping ¶
ChannelBeginTyping is a websocket method to start typing in a channel
func (*Session) ChannelDelete ¶
func (*Session) ChannelEdit ¶
func (s *Session) ChannelEdit(cID string, data ChannelEditData) (channel *Channel, err error)
func (*Session) ChannelEndTyping ¶
ChannelEndTyping is a websocket method to stop typing in a channel
func (*Session) ChannelInviteCreate ¶
func (s *Session) ChannelInviteCreate(cID string) (invite *InviteCreate, err error)
func (*Session) ChannelMessage ¶
func (*Session) ChannelMessageDelete ¶
func (*Session) ChannelMessageDeleteBulk ¶
func (s *Session) ChannelMessageDeleteBulk(cID string, messages ChannelMessageBulkDeleteData) error
func (*Session) ChannelMessageEdit ¶
func (s *Session) ChannelMessageEdit(cID, mID string, data MessageEditData) (message *Message, err error)
func (*Session) ChannelMessageReactionClear ¶
ChannelMessageReactionClear clears all reactions on a message
func (*Session) ChannelMessageReactionCreate ¶
ChannelMessageReactionCreate adds a reaction (emoji ID) to a message
func (*Session) ChannelMessageReactionDelete ¶
ChannelMessageReactionDelete deletes a singular reaction on a message
func (*Session) ChannelMessageSend ¶
func (s *Session) ChannelMessageSend(cID string, data MessageSend) (message *Message, err error)
func (*Session) ChannelMessages ¶
func (s *Session) ChannelMessages(cID string, params ...ChannelMessagesParams) (messages []*Message, err error)
func (*Session) ChannelPermissionsSet ¶
func (s *Session) ChannelPermissionsSet(sID, cID string, data PermissionAD) (err error)
func (*Session) ChannelPermissionsSetDefault ¶
func (s *Session) ChannelPermissionsSetDefault(sID string, data PermissionAD) (err error)
func (*Session) ChannelWebhooks ¶
func (*Session) ChannelWebhooksCreate ¶
func (s *Session) ChannelWebhooksCreate(cID string, data WebhookCreate) (webhook *Webhook, err error)
func (*Session) DirectMessageCreate ¶
DirectMessageCreate opens a direct message channel with a user Will return an error "MissingPermission" "SendMessage" if you are not friends or blocked
func (*Session) DirectMessages ¶
DirectMessages returns a list of direct message channels.
func (*Session) EmojiCreate ¶
func (s *Session) EmojiCreate(eID string, data EmojiCreateData) (emoji *Emoji, err error)
func (*Session) EmojiDelete ¶
func (*Session) FriendDelete ¶
FriendDelete removes a friend or declines a friend Request.
func (*Session) GroupCreate ¶
func (s *Session) GroupCreate(data GroupCreateData) (group *Group, err error)
GroupCreate creates a group based on the data provided "Users" field is a list of user IDs that will be in the group
func (*Session) GroupMemberAdd ¶
func (*Session) GroupMemberDelete ¶
func (*Session) GroupMembers ¶
func (*Session) InviteDelete ¶
func (*Session) Login ¶
func (s *Session) Login(data LoginData) (mfa LoginResponse, err error)
Login as a regular user instead of bot. Friendly name is used to identify the session via MFA
func (*Session) MessageAck ¶
func (*Session) Onboarding ¶
func (s *Session) Onboarding() (onboarding Onboarding, err error)
Onboarding returns whether the current account requires onboarding or whether you can continue to send requests as usual
func (*Session) OnboardingComplete ¶
func (s *Session) OnboardingComplete(data OnboardingCompleteData) error
OnboardingComplete sets a new username, completes onboarding and allows a user to start using Revolt.
func (*Session) Open ¶
Open determines the websocket URL and establishes a connection. It also detects if you are logged in as a user or a bot.
func (*Session) PasswordReset ¶
func (s *Session) PasswordReset(data AccountReverifyData) error
PasswordReset requests a password reset, which is sent to the email provided
func (*Session) PasswordResetConfirm ¶
func (s *Session) PasswordResetConfirm(data PasswordResetConfirmData) error
PasswordResetConfirm confirms a password reset
func (*Session) PermissionsSet ¶
func (s *Session) PermissionsSet(sID, rID string, data PermissionAD) (err error)
func (*Session) PermissionsSetDefault ¶
func (s *Session) PermissionsSetDefault(sID string, data PermissionsSetDefaultData) (err error)
PermissionsSetDefault sets the permissions of a role in a server
func (*Session) PushSubscribe ¶
func (s *Session) PushSubscribe(data WebpushSubscription) error
func (*Session) PushUnsubscribe ¶
func (s *Session) PushUnsubscribe(data WebpushSubscription) error
func (*Session) Relationships ¶
func (s *Session) Relationships() (relationships []*UserRelations, err error)
Relationships returns a list of relationships for the current user
func (*Session) Request ¶
Request sends a JSON Request with "method" to a destination URL - "result" will be used to decode the response into, and - "data" is the Request body which wil be encoded as JSON
- If the "data" is a *File, it will be uploaded as a multipart form This function automatically handles rate-limiting and response status codes
func (*Session) ServerBans ¶
func (s *Session) ServerBans(sID string) (bans []*ServerBans, err error)
func (*Session) ServerChannelCreate ¶
func (s *Session) ServerChannelCreate(sID string, data ServerChannelCreateData) (channel *Channel, err error)
func (*Session) ServerCreate ¶
func (s *Session) ServerCreate(data ServerCreateData) (server *Server, err error)
ServerCreate creates a server based on the data provided
func (*Session) ServerDelete ¶
func (*Session) ServerEdit ¶
func (s *Session) ServerEdit(id string, data ServerEditData) (server *Server, err error)
func (*Session) ServerMember ¶
func (s *Session) ServerMember(sID, mID string) (member *ServerMember, err error)
func (*Session) ServerMemberBan ¶
func (*Session) ServerMemberDelete ¶
func (*Session) ServerMemberEdit ¶
func (s *Session) ServerMemberEdit(sID, mID string, data ServerMemberEditData) (member *ServerMember, err error)
func (*Session) ServerMemberUnban ¶
func (*Session) ServerMembers ¶
func (s *Session) ServerMembers(sID string) (members *ServerMembers, err error)
func (*Session) ServerRoleDelete ¶
func (*Session) ServersRole ¶
func (s *Session) ServersRole(sID, rID string) (role *ServerRole, err error)
func (*Session) ServersRoleCreate ¶
func (s *Session) ServersRoleCreate(sID string, data ServerRoleCreateData) (role *ServerRole, err error)
func (*Session) ServersRoleEdit ¶
func (s *Session) ServersRoleEdit(sID, rID string, data ServerRoleEditData) (role *ServerRole, err error)
func (*Session) SessionEdit ¶
func (s *Session) SessionEdit(id string, data SessionEditData) (session SessionEditData, err error)
func (*Session) SessionsDelete ¶
SessionsDelete invalidates a session with the provided ID
func (*Session) SessionsDeleteAll ¶
SessionsDeleteAll invalidates all sessions, including this one if revokeSelf is true
func (*Session) SetUsername ¶
func (s *Session) SetUsername(data UsernameData) (user *User, err error)
func (*Session) SyncSettingsFetch ¶
func (s *Session) SyncSettingsFetch(payload SyncSettingsFetchData) (data *SyncSettingsData, err error)
func (*Session) SyncSettingsSet ¶
func (s *Session) SyncSettingsSet(payload SyncSettingsData) error
func (*Session) SyncUnreads ¶
func (s *Session) SyncUnreads() (data []SyncUnread, err error)
func (*Session) Uptime ¶
Uptime returns the approximate duration the websocket has been connected for
func (*Session) UserDefaultAvatar ¶
func (*Session) UserEdit ¶
func (s *Session) UserEdit(uID string, data UserEditData) (user *User, err error)
func (*Session) UserMutual ¶
func (s *Session) UserMutual(uID string) (mutual []*MutualFriendsAndServersResponse, err error)
func (*Session) UserProfile ¶
func (s *Session) UserProfile(uID string) (profile *UserProfile, err error)
func (*Session) VerifyEmail ¶
func (s *Session) VerifyEmail(code string) (ticket ChangeEmail, err error)
func (*Session) WriteSocket ¶
WriteSocket writes data to the websocket in JSON
type SessionEditData ¶
type SessionEditData struct {
FriendlyName string `json:"friendly_name"`
}
type State ¶
type State struct {
// contains filtered or unexported fields
}
func (*State) ChannelPermissions ¶
ChannelPermissions is a utility function to calculate permissions for a user in a Channel
func (*State) Member ¶
func (s *State) Member(uID, sID string) *ServerMember
func (*State) Members ¶
func (s *State) Members(sID string) []*ServerMember
func (*State) Role ¶
func (s *State) Role(sID, rID string) *ServerRole
func (*State) ServerPermissions ¶
ServerPermissions is a utility function to calculate permissions for a user in a Server
func (*State) TrackAPICalls ¶
func (*State) TrackBulkAPICalls ¶
func (*State) TrackChannels ¶
func (*State) TrackEmojis ¶
func (*State) TrackMembers ¶
func (*State) TrackServers ¶
func (*State) TrackUsers ¶
func (*State) TrackWebhooks ¶
type SyncSettingsData ¶
type SyncSettingsData map[string]UpdateTuple
type SyncSettingsFetchData ¶
type SyncSettingsFetchData struct {
Keys []string `json:"keys"`
}
type SyncUnread ¶
type SyncUnread struct { ID CompositeChannelID `json:"_id"` LastID string `json:"last_id"` Mentions []string `json:"mentions"` }
type UpdateTuple ¶
type User ¶
type User struct { ID string `json:"_id"` Username string `json:"username"` Discriminator string `json:"discriminator"` DisplayName string `json:"display_name"` Avatar *Attachment `json:"avatar"` Relations []*UserRelations `json:"relations"` // Bitfield of user badges Badges int `json:"badges"` // User's active status Status *UserStatus `json:"status"` // todo: potentially deprecated Profile *UserProfile `json:"profile"` // Enum of user flags Flags *int `json:"flags"` // Racism?!1 Privileged bool `json:"privileged"` // Bot information, if the user is a bot Bot *Bot `json:"bot"` // Your relationship to this user Relationship UserRelationshipType `json:"relationship"` // Whether this user is currently online Online bool `json:"online"` }
type UserEditData ¶
type UserEditData struct { DisplayName string `json:"display_name,omitempty"` Avatar string `json:"avatar,omitempty"` Status *UserStatus `json:"status,omitempty"` Profile *UserProfile `json:"profile,omitempty"` Badges *int `json:"badges,omitempty"` Flags *int `json:"flags,omitempty"` Remove []string `json:"remove,omitempty"` }
type UserProfile ¶
type UserProfile struct { Content string `json:"content,omitempty"` Background *Attachment `json:"background,omitempty"` }
type UserRelations ¶
type UserRelations struct { ID string `json:"_id"` Status UserRelationshipType `json:"status"` }
type UserRelationshipType ¶
type UserRelationshipType string
type UserSettings ¶
type UserSettings struct { Updated int Data json.RawMessage }
UserSettings TODO: This does not get decoded due to API sending tuples for some god-forsaken reason
type UserStatus ¶
type UserStatus struct { Text string `json:"text,omitempty"` Presence UserStatusPresence `json:"presence"` }
type UserStatusPresence ¶
type UserStatusPresence string
const ( UserStatusPresenceOnline UserStatusPresence = "Online" UserStatusPresenceIdle UserStatusPresence = "Idle" UserStatusPresenceFocus UserStatusPresence = "Focus" UserStatusPresenceBusy UserStatusPresence = "Busy" UserStatusPresenceInvisible UserStatusPresence = "Invisible" )
type UsernameData ¶
type Webhook ¶
type Webhook struct { ID string `json:"id"` Name string `json:"name"` Avatar *Attachment `json:"avatar"` ChannelID string `json:"channel_id"` Token string `json:"token"` }
type WebhookCreate ¶
type WebpushSubscription ¶
type WebsocketChannelTyping ¶
type WebsocketChannelTyping struct { Type WebsocketMessageType `json:"type"` Channel string `json:"channel"` }
type WebsocketMessageAuthenticate ¶
type WebsocketMessageAuthenticate struct { Type WebsocketMessageType `json:"type"` Token string `json:"token"` }
type WebsocketMessagePing ¶
type WebsocketMessagePing struct { Type WebsocketMessageType `json:"type"` Data int64 `json:"data"` }
type WebsocketMessageType ¶
type WebsocketMessageType string
const ( WebsocketKeepAlivePeriod = 60 * time.Second WebsocketMessageTypeAuthenticate WebsocketMessageType = "Authenticate" WebsocketMessageTypeHeartbeat WebsocketMessageType = "Ping" WebsocketMessageTypeBeginTyping WebsocketMessageType = "BeginTyping" WebsocketMessageTypeEndTyping WebsocketMessageType = "EndTyping" )