This commit is contained in:
Bruce 2017-09-03 20:01:46 +00:00
parent 1b5dbef04e
commit 06b35cfe24
5 changed files with 10 additions and 5 deletions

View file

@ -11,8 +11,8 @@
package discordgo package discordgo
// The Discord API version used for the REST and Websocket API. // APIVersion is the Discord API version used for the REST and Websocket API.
var ApiVersion = "6" var APIVersion = "6"
// Known Discord API Endpoints. // Known Discord API Endpoints.
var ( var (
@ -22,7 +22,7 @@ var (
EndpointSmUpcoming = EndpointSm + "upcoming.json" EndpointSmUpcoming = EndpointSm + "upcoming.json"
EndpointDiscord = "https://discordapp.com/" EndpointDiscord = "https://discordapp.com/"
EndpointAPI = EndpointDiscord + "api/v" + ApiVersion + "/" EndpointAPI = EndpointDiscord + "api/v" + APIVersion + "/"
EndpointGuilds = EndpointAPI + "guilds/" EndpointGuilds = EndpointAPI + "guilds/"
EndpointChannels = EndpointAPI + "channels/" EndpointChannels = EndpointAPI + "channels/"
EndpointUsers = EndpointAPI + "users/" EndpointUsers = EndpointAPI + "users/"

View file

@ -15,8 +15,10 @@ import (
"strings" "strings"
) )
// MessageType is the type of Message
type MessageType int type MessageType int
// Block contains the valid known MessageType values
const ( const (
MessageTypeDefault MessageType = iota MessageTypeDefault MessageType = iota
MessageTypeRecipientAdd MessageTypeRecipientAdd

View file

@ -782,7 +782,7 @@ func (s *State) onReady(se *Session, r *Ready) (err error) {
return nil return nil
} }
// onInterface handles all events related to states. // OnInterface handles all events related to states.
func (s *State) OnInterface(se *Session, i interface{}) (err error) { func (s *State) OnInterface(se *Session, i interface{}) (err error) {
if s == nil { if s == nil {
return ErrNilState return ErrNilState

View file

@ -148,8 +148,10 @@ type Invite struct {
Temporary bool `json:"temporary"` Temporary bool `json:"temporary"`
} }
// ChannelType is the type of a Channel
type ChannelType int type ChannelType int
// Block contains known ChannelType values
const ( const (
ChannelTypeGuildText ChannelType = iota ChannelTypeGuildText ChannelType = iota
ChannelTypeDM ChannelTypeDM
@ -604,6 +606,7 @@ const (
PermissionAdministrator PermissionAdministrator
) )
// Block contains Discord JSON Error Response codes
const ( const (
ErrCodeUnknownAccount = 10001 ErrCodeUnknownAccount = 10001
ErrCodeUnknownApplication = 10002 ErrCodeUnknownApplication = 10002

View file

@ -86,7 +86,7 @@ func (s *Session) Open() (err error) {
} }
// Add the version and encoding to the URL // Add the version and encoding to the URL
s.gateway = s.gateway + "?v=" + ApiVersion + "&encoding=json" s.gateway = s.gateway + "?v=" + APIVersion + "&encoding=json"
} }
header := http.Header{} header := http.Header{}