diff --git a/events.go b/events.go index c2a9d20d0..e19290ec0 100644 --- a/events.go +++ b/events.go @@ -53,6 +53,7 @@ type ChannelCreate struct { // ChannelUpdate is the data for a ChannelUpdate event. type ChannelUpdate struct { *Channel + BeforeUpdate *Channel `json:"-"` } // ChannelDelete is the data for a ChannelDelete event. diff --git a/state.go b/state.go index d0c7b4222..bac4bf3f3 100644 --- a/state.go +++ b/state.go @@ -1056,6 +1056,11 @@ func (s *State) OnInterface(se *Session, i interface{}) (err error) { } case *ChannelUpdate: if s.TrackChannels { + old, err := s.Channel(t.ID) + if err == nil { + oldCopy := *old + t.BeforeUpdate = &oldCopy + } err = s.ChannelAdd(t.Channel) } case *ChannelDelete: