Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var IntentsFlags = map[string]Intent{
"Guilds": 1 << 0,
"GuildMembers": 1 << 1,
"GuildBans": 1 << 2,
"GuildEmojisAndStickers": 1 << 3,
"GuildIntegrations": 1 << 4,
"GuildWebhooks": 1 << 5,
"GuildInvites": 1 << 6,
"GuildVoiceStates": 1 << 7,
"GuildPresences": 1 << 8,
"GuildMessages": 1 << 9,
"GuildMessageReactions": 1 << 10,
"GuildMessageTyping": 1 << 11,
"DirectMessages": 1 << 12,
"DirectMessageReactions": 1 << 13,
"DirectMessageTyping": 1 << 14,
"MessageContent": 1 << 15,
"GuildScheduledEvents": 1 << 16,
}
A map of intents to their bitfield value Reference: https://canary.discord.com/developers/docs/topics/gateway#gateway-intents
fmt.Println(IntentsFlags["Guilds"])
Functions ¶
This section is empty.
Types ¶
type GatewayHeartbeatSendPacket ¶
Packet structures
type Identify ¶
type Identify struct { // Token used to start a new session Token string `json:"token"` Intents Intent `json:"intents"` ShardID int `json:"shard_id"` ShardCount int `json:"shard_count"` Compress bool `json:"compress"` LargeThreshold int `json:"large_threshold"` Properties Properties `json:"properties"` }
A structure representing a Discord session
type Intent ¶
type Intent uint64
func CalcIntents ¶
Calculates the bitfield value for the given intents
intents, err := CalcIntents("Guilds", "GuildMembers")
type Properties ¶
type Properties struct { Browser string `json:"$browser"` Device string `json:"$device"` Os string `json:"$os"` }
A structure representing the properties of a Identify object
type Session ¶
type Session struct { // The Identify structure of this session Identify Identify `json:"identify"` // contains filtered or unexported fields }
func New ¶
The main hub for interacting with the Discord API, and the starting point for any bot
s := disgo.New("My bot token")
func (*Session) AddListener ¶
Add a Discord event handler
func ReadyEvent(data map[string]interface{}) { fmt.Println("Bot is ready!") } session.AddListener("READY", ReadyEvent)
func (*Session) Connect ¶
Logs the client in, establishing a WebSocket connection to Discord This function blocks until the connection is lost, ended or an error occurs
s := disgo.New("My bot token") err := s.Connect()
Click to show internal directories.
Click to hide internal directories.