Make sure MemberCount isn't stomped when Guilds are added.

This commit is contained in:
Chris Rhodes 2018-07-23 20:09:49 -07:00 committed by GitHub
parent d7a58a4f11
commit d6e795c573
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -99,6 +99,9 @@ func (s *State) GuildAdd(guild *Guild) error {
if g, ok := s.guildMap[guild.ID]; ok {
// We are about to replace `g` in the state with `guild`, but first we need to
// make sure we preserve any fields that the `guild` doesn't contain from `g`.
if guild.MemberCount == 0 {
guild.MemberCount = g.MemberCount
}
if guild.Roles == nil {
guild.Roles = g.Roles
}