Documentation ¶
Index ¶
- Constants
- func URLFor(endpoint string, args ...any) string
- type Client
- func (c *Client) CheckAPIResponse(resp *http.Response)
- func (c *Client) Connect(ctx context.Context) error
- func (c *Client) DecodeFormatting(msg Message) string
- func (c *Client) Errors() <-chan error
- func (c *Client) Fatal() <-chan struct{}
- func (c *Client) Post(ctx context.Context, url string, data any) (*http.Response, error)
- func (c *Client) Run(ctx context.Context, dataCh chan<- Message, errCh chan<- error)
- type CloseCode
- type EventType
- type GatewayEvent
- type GatewayResume
- type HelloData
- type Intent
- type Message
- type OpType
- type Ready
- type User
Constants ¶
View Source
const ( UnknownError websocket.StatusCode = 4000 UnknownOpcode websocket.StatusCode = 4001 DecodeError websocket.StatusCode = 4002 NotAuthenticated websocket.StatusCode = 4003 AuthenticationFailed websocket.StatusCode = 4004 AlreadyAuthenticated websocket.StatusCode = 4005 InvalidSeq websocket.StatusCode = 4007 RateLimited websocket.StatusCode = 4008 SessionTimedOut websocket.StatusCode = 4009 InvalidShard websocket.StatusCode = 4010 ShardingRequired websocket.StatusCode = 4011 InvalidAPIVersion websocket.StatusCode = 4012 InvalidIntent websocket.StatusCode = 4013 DisallowedIntent websocket.StatusCode = 4014 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct { Err error // set on fatal errors // contains filtered or unexported fields }
func (*Client) CheckAPIResponse ¶
This is obviously stupid.
func (*Client) DecodeFormatting ¶
type GatewayEvent ¶
type GatewayResume ¶
type GatewayResume struct { Token string `json:"token"` SessionID string `json:"session_id"` Seq *int `json:"seq"` }
payload for sending resume ops
type HelloData ¶
type HelloData struct {
HeartbeatInterval int `mapstructure:"heartbeat_interval"`
}
type Intent ¶
type Intent int
const ( Guilds Intent = 1 << iota GuildMembers GuildModeration GuildEmojiAndStickers GuildIntegrations GuildWebhooks GuildInvites GuildVoiceStates GuildPresences GuildMessages GuildMessageReactions GuildMessageTyping DirectMessages DirectMessageReactions DirectMessageTyping MessageContent GuildScheduledEvents AutoModerationConfiguration = 1 << 20 AutoModerationExecution = 1 << 21 )
taken from https://discord.com/developers/docs/topics/gateway#list-of-intents
type Message ¶
type Message struct { ID string Author User Content string ChannelID string `mapstructure:"channel_id"` Mentions []User }
incomplete, obviously
type OpType ¶
type OpType int
const ( // An event was dispatched Dispatch OpType = iota // Fired periodically by the client to keep the connection alive. Heartbeat // Starts a new session during the initial handshake. Identify // Update the client's presence. PresenceUpdate // Used to join/leave or move between voice channels. VoiceStateUpdate // Resume a previous session that was disconnected. Resume // You should attempt to reconnect and resume immediately. Reconnect // Request information about offline guild members in a large guild. RequestGuildMembers // The session has been invalidated. You should reconnect and identify/resume accordingly. InvalidSession // Sent immediately after connecting, contains the heartbeat_interval to use. Hello // Sent in response to receiving a heartbeat to acknowledge that it has been received. HeartbeatACK )
Click to show internal directories.
Click to hide internal directories.