|
@@ -1,5 +1,11 @@
|
|
|
package discordgo
|
|
|
|
|
|
+import (
|
|
|
+ "net"
|
|
|
+
|
|
|
+ "golang.org/x/net/websocket"
|
|
|
+)
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
@@ -60,3 +66,255 @@ type Invite struct {
|
|
|
XkcdPass bool `json:"xkcdpass"`
|
|
|
Channel Channel `json:"channel"`
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+type Channel struct {
|
|
|
+ ID string `json:"id"`
|
|
|
+ GuildID string `json:"guild_id"`
|
|
|
+ Name string `json:"name"`
|
|
|
+ Topic string `json:"topic"`
|
|
|
+ Position int `json:"position"`
|
|
|
+ Type string `json:"type"`
|
|
|
+ PermissionOverwrites []PermissionOverwrite `json:"permission_overwrites"`
|
|
|
+ IsPrivate bool `json:"is_private"`
|
|
|
+ LastMessageID string `json:"last_message_id"`
|
|
|
+ Recipient User `json:"recipient"`
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+type PermissionOverwrite struct {
|
|
|
+ ID string `json:"id"`
|
|
|
+ Type string `json:"type"`
|
|
|
+ Deny int `json:"deny"`
|
|
|
+ Allow int `json:"allow"`
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+type Guild struct {
|
|
|
+ ID string `json:"id"`
|
|
|
+ Name string `json:"name"`
|
|
|
+ Icon string `json:"icon"`
|
|
|
+ Region string `json:"region"`
|
|
|
+ AfkTimeout int `json:"afk_timeout"`
|
|
|
+ AfkChannelID string `json:"afk_channel_id"`
|
|
|
+ EmbedChannelID string `json:"embed_channel_id"`
|
|
|
+ EmbedEnabled bool `json:"embed_enabled"`
|
|
|
+ OwnerID string `json:"owner_id"`
|
|
|
+ Large bool `json:"large"`
|
|
|
+ JoinedAt string `json:"joined_at"`
|
|
|
+ Roles []Role `json:"roles"`
|
|
|
+ Members []Member `json:"members"`
|
|
|
+ Presences []Presence `json:"presences"`
|
|
|
+ Channels []Channel `json:"channels"`
|
|
|
+ VoiceStates []VoiceState `json:"voice_states"`
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+type Role struct {
|
|
|
+ ID string `json:"id"`
|
|
|
+ Name string `json:"name"`
|
|
|
+ Managed bool `json:"managed"`
|
|
|
+ Color int `json:"color"`
|
|
|
+ Hoist bool `json:"hoist"`
|
|
|
+ Position int `json:"position"`
|
|
|
+ Permissions int `json:"permissions"`
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+type VoiceState struct {
|
|
|
+ UserID string `json:"user_id"`
|
|
|
+ Suppress bool `json:"suppress"`
|
|
|
+ SessionID string `json:"session_id"`
|
|
|
+ SelfMute bool `json:"self_mute"`
|
|
|
+ SelfDeaf bool `json:"self_deaf"`
|
|
|
+ Mute bool `json:"mute"`
|
|
|
+ Deaf bool `json:"deaf"`
|
|
|
+ ChannelID string `json:"channel_id"`
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+type Presence struct {
|
|
|
+ User User `json:"user"`
|
|
|
+ Status string `json:"status"`
|
|
|
+ GameID int `json:"game_id"`
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+type Member struct {
|
|
|
+ GuildID string `json:"guild_id"`
|
|
|
+ JoinedAt string `json:"joined_at"`
|
|
|
+ Deaf bool `json:"deaf"`
|
|
|
+ Mute bool `json:"mute"`
|
|
|
+ User User `json:"user"`
|
|
|
+ Roles []string `json:"roles"`
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+type Session struct {
|
|
|
+ Token string
|
|
|
+ Debug bool
|
|
|
+ Cache int
|
|
|
+ SessionID string
|
|
|
+
|
|
|
+
|
|
|
+ OnEvent func(*Session, Event) // should Event be *Event?
|
|
|
+ OnReady func(*Session, Ready)
|
|
|
+ OnTypingStart func(*Session, TypingStart)
|
|
|
+ OnMessageCreate func(*Session, Message)
|
|
|
+ OnMessageUpdate func(*Session, Message)
|
|
|
+ OnMessageDelete func(*Session, MessageDelete)
|
|
|
+ OnMessageAck func(*Session, MessageAck)
|
|
|
+ OnPresenceUpdate func(*Session, PresenceUpdate)
|
|
|
+ OnVoiceStateUpdate func(*Session, VoiceState)
|
|
|
+ OnChannelCreate func(*Session, Channel)
|
|
|
+ OnChannelUpdate func(*Session, Channel)
|
|
|
+ OnChannelDelete func(*Session, Channel)
|
|
|
+ OnGuildCreate func(*Session, Guild)
|
|
|
+ OnGuildUpdate func(*Session, Guild)
|
|
|
+ OnGuildDelete func(*Session, Guild)
|
|
|
+ OnGuildMemberAdd func(*Session, Member)
|
|
|
+ OnGuildMemberRemove func(*Session, Member)
|
|
|
+ OnGuildMemberDelete func(*Session, Member) // which is it?
|
|
|
+ OnGuildMemberUpdate func(*Session, Member)
|
|
|
+ OnGuildRoleCreate func(*Session, GuildRole)
|
|
|
+ OnGuildRoleUpdate func(*Session, GuildRole)
|
|
|
+ OnGuildRoleDelete func(*Session, GuildRoleDelete)
|
|
|
+ OnGuildIntegrationsUpdate func(*Session, GuildIntegrationsUpdate)
|
|
|
+
|
|
|
+ wsConn *websocket.Conn
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ VwsConn *websocket.Conn
|
|
|
+ VSessionID string
|
|
|
+ VToken string
|
|
|
+ VEndpoint string
|
|
|
+ VGuildID string
|
|
|
+ VChannelID string
|
|
|
+ Vop2 VoiceOP2
|
|
|
+ UDPConn *net.UDPConn
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+type User struct {
|
|
|
+ ID string `json:"id"`
|
|
|
+ Email string `json:"email"`
|
|
|
+ Username string `json:"username"`
|
|
|
+ Avatar string `json:"Avatar"`
|
|
|
+ Verified bool `json:"verified"`
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+type PrivateChannel struct {
|
|
|
+ ID string `json:"id"`
|
|
|
+ IsPrivate bool `json:"is_private"`
|
|
|
+ LastMessageID string `json:"last_message_id"`
|
|
|
+ Recipient User `json:"recipient"`
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+type Settings struct {
|
|
|
+ RenderEmbeds bool `json:"render_embeds"`
|
|
|
+ InlineEmbedMedia bool `json:"inline_embed_media"`
|
|
|
+ EnableTtsCommand bool `json:"enable_tts_command"`
|
|
|
+ MessageDisplayCompact bool `json:"message_display_compact"`
|
|
|
+ Locale string `json:"locale"`
|
|
|
+ ShowCurrentGame bool `json:"show_current_game"`
|
|
|
+ Theme string `json:"theme"`
|
|
|
+ MutedChannels []string `json:"muted_channels"`
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+type Event struct {
|
|
|
+ Type string `json:"t"`
|
|
|
+ State int `json:"s"`
|
|
|
+ Operation int `json:"o"`
|
|
|
+ Direction int `json:"dir"`
|
|
|
+ RawData json.RawMessage `json:"d"`
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+type Ready struct {
|
|
|
+ Version int `json:"v"`
|
|
|
+ SessionID string `json:"session_id"`
|
|
|
+ HeartbeatInterval time.Duration `json:"heartbeat_interval"`
|
|
|
+ User User `json:"user"`
|
|
|
+ ReadState []ReadState
|
|
|
+ PrivateChannels []PrivateChannel
|
|
|
+ Guilds []Guild
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+type ReadState struct {
|
|
|
+ MentionCount int
|
|
|
+ LastMessageID string `json:"last_message_id"`
|
|
|
+ ID string `json:"id"`
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+type TypingStart struct {
|
|
|
+ UserID string `json:"user_id"`
|
|
|
+ ChannelID string `json:"channel_id"`
|
|
|
+ Timestamp int `json:"timestamp"`
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+type PresenceUpdate struct {
|
|
|
+ User User `json:"user"`
|
|
|
+ Status string `json:"status"`
|
|
|
+ Roles []string `json:"roles"`
|
|
|
+ GuildID string `json:"guild_id"`
|
|
|
+ GameID int `json:"game_id"`
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+type MessageAck struct {
|
|
|
+ MessageID string `json:"message_id"`
|
|
|
+ ChannelID string `json:"channel_id"`
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+type MessageDelete struct {
|
|
|
+ ID string `json:"id"`
|
|
|
+ ChannelID string `json:"channel_id"`
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+type GuildIntegrationsUpdate struct {
|
|
|
+ GuildID string `json:"guild_id"`
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+type GuildRole struct {
|
|
|
+ Role Role `json:"role"`
|
|
|
+ GuildID string `json:"guild_id"`
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+type GuildRoleDelete struct {
|
|
|
+ RoleID string `json:"role_id"`
|
|
|
+ GuildID string `json:"guild_id"`
|
|
|
+}
|