forked from pothtonswer/discordmuffin
Work around a Discord server issue.
This commit is contained in:
parent
f58410afa4
commit
abc0e5b095
2 changed files with 14 additions and 10 deletions
17
structs.go
17
structs.go
|
@ -170,13 +170,14 @@ type Guild struct {
|
||||||
|
|
||||||
// A Role stores information about Discord guild member roles.
|
// A Role stores information about Discord guild member roles.
|
||||||
type Role struct {
|
type Role struct {
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Managed bool `json:"managed"`
|
Managed bool `json:"managed"`
|
||||||
Hoist bool `json:"hoist"`
|
Hoist bool `json:"hoist"`
|
||||||
Color int `json:"color"`
|
// This is coming back as an int or string, for now do not parse.
|
||||||
Position int `json:"position"`
|
Color int `json:"-"`
|
||||||
Permissions int `json:"permissions"`
|
Position int `json:"position"`
|
||||||
|
Permissions int `json:"permissions"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// A VoiceState stores the voice states of Guilds
|
// A VoiceState stores the voice states of Guilds
|
||||||
|
@ -274,7 +275,7 @@ type RateLimit struct {
|
||||||
|
|
||||||
// A ReadState stores data on the read state of channels.
|
// A ReadState stores data on the read state of channels.
|
||||||
type ReadState struct {
|
type ReadState struct {
|
||||||
MentionCount int
|
MentionCount int `json:"mention_count"`
|
||||||
LastMessageID string `json:"last_message_id"`
|
LastMessageID string `json:"last_message_id"`
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
}
|
}
|
||||||
|
|
7
wsapi.go
7
wsapi.go
|
@ -284,8 +284,11 @@ func (s *Session) event(messageType int, message []byte) {
|
||||||
// Attempt to unmarshal our event.
|
// Attempt to unmarshal our event.
|
||||||
// If there is an error we should handle the event itself.
|
// If there is an error we should handle the event itself.
|
||||||
if err = unmarshal(e.RawData, i); err != nil {
|
if err = unmarshal(e.RawData, i); err != nil {
|
||||||
fmt.Println("Unable to unmarshal event data.")
|
fmt.Println("Unable to unmarshal event data.", err)
|
||||||
i = e
|
// Ready events must fire, even if they are empty.
|
||||||
|
if e.Type != "READY" {
|
||||||
|
i = e
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
fmt.Println("Unknown event.")
|
fmt.Println("Unknown event.")
|
||||||
|
|
Loading…
Reference in a new issue