1
0
Fork 0
mirror of https://github.com/diamondburned/arikawa.git synced 2024-11-30 10:43:30 +00:00

state: Fix decrementing reaction count (#302)

* state: fix updating reaction count in reaction remove event

* move r.Me branch to if
This commit is contained in:
Juby210 2022-01-18 01:35:49 +01:00 committed by GitHub
parent 11432e426c
commit 2d3bf2974a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -276,12 +276,14 @@ func (s *State) onEvent(iface interface{}) {
copy(m.Reactions[0:], old[:i])
copy(m.Reactions[i:], old[i+1:])
case r.Me: // If reaction removal is the user's
u, err := s.Cabinet.Me()
if err == nil && ev.UserID == u.ID {
r.Me = false
}
default:
r.Count--
if r.Me { // If reaction removal is the user's
u, err := s.Cabinet.Me()
if err == nil && ev.UserID == u.ID {
r.Me = false
}
}
}
return true