Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add BeforeDelete to GuildDelete struct #962

Merged
merged 1 commit into from
Aug 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions events.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ type GuildUpdate struct {
// GuildDelete is the data for a GuildDelete event.
type GuildDelete struct {
*Guild
BeforeDelete *Guild `json:"-"`
}

// GuildBanAdd is the data for a GuildBanAdd event.
Expand Down
7 changes: 7 additions & 0 deletions state.go
Original file line number Diff line number Diff line change
Expand Up @@ -836,6 +836,13 @@ func (s *State) OnInterface(se *Session, i interface{}) (err error) {
case *GuildUpdate:
err = s.GuildAdd(t.Guild)
case *GuildDelete:
var old *Guild
old, err = s.Guild(t.ID)
if err == nil {
oldCopy := *old
t.BeforeDelete = &oldCopy
}

err = s.GuildRemove(t.Guild)
case *GuildMemberAdd:
// Updates the MemberCount of the guild.
Expand Down
4 changes: 2 additions & 2 deletions structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -1202,8 +1202,8 @@ const (
ActivityTypeGame ActivityType = 0
ActivityTypeStreaming ActivityType = 1
ActivityTypeListening ActivityType = 2
// ActivityTypeWatching // not valid in this use case?
ActivityTypeCustom ActivityType = 4
ActivityTypeWatching ActivityType = 3
ActivityTypeCustom ActivityType = 4
)

// Identify is sent during initial handshake with the discord gateway.
Expand Down