1
0
Fork 0
mirror of https://github.com/diamondburned/arikawa.git synced 2025-01-07 12:38:05 +00:00

Gateway: Deprecated useless type definitions for embedded structs

This commit is contained in:
diamondburned 2020-07-14 21:38:31 -07:00
parent 5b37b2ab0d
commit 9d7f5cb953
2 changed files with 16 additions and 8 deletions

View file

@ -20,9 +20,15 @@ type (
// https://discordapp.com/developers/docs/topics/gateway#channels // https://discordapp.com/developers/docs/topics/gateway#channels
type ( type (
ChannelCreateEvent discord.Channel ChannelCreateEvent struct {
ChannelUpdateEvent discord.Channel discord.Channel
ChannelDeleteEvent discord.Channel }
ChannelUpdateEvent struct {
discord.Channel
}
ChannelDeleteEvent struct {
discord.Channel
}
ChannelPinsUpdateEvent struct { ChannelPinsUpdateEvent struct {
GuildID discord.Snowflake `json:"guild_id,omitempty"` GuildID discord.Snowflake `json:"guild_id,omitempty"`
ChannelID discord.Snowflake `json:"channel_id,omitempty"` ChannelID discord.Snowflake `json:"channel_id,omitempty"`
@ -54,7 +60,9 @@ type (
Channels []discord.Channel `json:"channels,omitempty"` Channels []discord.Channel `json:"channels,omitempty"`
Presences []discord.Presence `json:"presences,omitempty"` Presences []discord.Presence `json:"presences,omitempty"`
} }
GuildUpdateEvent discord.Guild GuildUpdateEvent struct {
discord.Guild
}
GuildDeleteEvent struct { GuildDeleteEvent struct {
ID discord.Snowflake `json:"id"` ID discord.Snowflake `json:"id"`
// Unavailable if false == removed // Unavailable if false == removed

View file

@ -80,7 +80,7 @@ func (s *State) onEvent(iface interface{}) {
} }
case *gateway.GuildUpdateEvent: case *gateway.GuildUpdateEvent:
if err := s.Store.GuildSet((*discord.Guild)(ev)); err != nil { if err := s.Store.GuildSet(&ev.Guild); err != nil {
s.stateErr(err, "failed to update guild in state") s.stateErr(err, "failed to update guild in state")
} }
@ -151,17 +151,17 @@ func (s *State) onEvent(iface interface{}) {
} }
case *gateway.ChannelCreateEvent: case *gateway.ChannelCreateEvent:
if err := s.Store.ChannelSet((*discord.Channel)(ev)); err != nil { if err := s.Store.ChannelSet(&ev.Channel); err != nil {
s.stateErr(err, "failed to create a channel in state") s.stateErr(err, "failed to create a channel in state")
} }
case *gateway.ChannelUpdateEvent: case *gateway.ChannelUpdateEvent:
if err := s.Store.ChannelSet((*discord.Channel)(ev)); err != nil { if err := s.Store.ChannelSet(&ev.Channel); err != nil {
s.stateErr(err, "failed to update a channel in state") s.stateErr(err, "failed to update a channel in state")
} }
case *gateway.ChannelDeleteEvent: case *gateway.ChannelDeleteEvent:
if err := s.Store.ChannelRemove((*discord.Channel)(ev)); err != nil { if err := s.Store.ChannelRemove(&ev.Channel); err != nil {
s.stateErr(err, "failed to remove a channel in state") s.stateErr(err, "failed to remove a channel in state")
} }