gateway

package
v10.2.6 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2024 License: GPL-3.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Version        = 10
	URLQueryString = "?v=" + string(rune(Version)) + "&encoding=json"
)

Variables

This section is empty.

Functions

func GetCloseCode

func GetCloseCode(c int) (code int, reconnect bool, description string)

Types

type Intents

type Intents uint64

Intents - Maintaining a stateful application can be difficult when it comes to the amount of data you're expected to process, especially at scale.

Gateway Intents are a system to help you lower that computational burden.

When identifying to the gateway, you can specify an intents parameter which allows you to conditionally subscribe to pre-defined "intents", groups of events defined by Discord.

If you do not specify a certain intent, you will not receive any of the gateway events that are batched into that group.

const (
	Guilds                      Intents = 1 << 0
	GuildMembers                Intents = 1 << 1
	GuildBans                   Intents = 1 << 2
	GuildEmojisAndStickers      Intents = 1 << 3
	GuildIntegrations           Intents = 1 << 4
	GuildWebhooks               Intents = 1 << 5
	GuildInvites                Intents = 1 << 6
	GuildVoiceStates            Intents = 1 << 7
	GuildPresences              Intents = 1 << 8
	GuildMessages               Intents = 1 << 9
	GuildMessageReactions       Intents = 1 << 10
	GuildMessageTyping          Intents = 1 << 11
	DirectMessages              Intents = 1 << 12
	DirectMessageReactions      Intents = 1 << 13
	DirectMessageTyping         Intents = 1 << 14
	MessageContent              Intents = 1 << 15
	GuildScheduleEvents         Intents = 1 << 16
	AutoModerationConfiguration Intents = 1 << 20
	AutoModerationExecution     Intents = 1 << 21
)

type OpCode

type OpCode int

OpCode

All gateway events in Discord are tagged with an opcode that denotes the payload type. Your connection to our gateway may also sometimes close. When it does, you will receive a close code that tells you what happened.

const (
	Dispatch OpCode = iota
	Heartbeat
	Identify
	PresenceUpdate
	VoiceStateUpdate
	Resume OpCode = iota + 1
	Reconnect
	RequestGuildMembers
	InvalidSession
	Hello
	HeartbeatAck
)

Jump to

Keyboard shortcuts

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