Skip to content

Commit d655d6d

Browse files
authored
Add BeforeDelete to GuildDelete struct (#962)
1 parent be90532 commit d655d6d

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

events.go

+1
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ type GuildUpdate struct {
8686
// GuildDelete is the data for a GuildDelete event.
8787
type GuildDelete struct {
8888
*Guild
89+
BeforeDelete *Guild `json:"-"`
8990
}
9091

9192
// GuildBanAdd is the data for a GuildBanAdd event.

state.go

+7
Original file line numberDiff line numberDiff line change
@@ -836,6 +836,13 @@ func (s *State) OnInterface(se *Session, i interface{}) (err error) {
836836
case *GuildUpdate:
837837
err = s.GuildAdd(t.Guild)
838838
case *GuildDelete:
839+
var old *Guild
840+
old, err = s.Guild(t.ID)
841+
if err == nil {
842+
oldCopy := *old
843+
t.BeforeDelete = &oldCopy
844+
}
845+
839846
err = s.GuildRemove(t.Guild)
840847
case *GuildMemberAdd:
841848
// Updates the MemberCount of the guild.

0 commit comments

Comments
 (0)