Esempio n. 1
0
        internal void Update(Guild model)
        {
            Update(model as GuildReference);

            if (model.AFKTimeout != null)
                AFKTimeout = model.AFKTimeout.Value;
            _afkChannelId = model.AFKChannelId; //Can be null
            if (model.JoinedAt != null)
                JoinedAt = model.JoinedAt.Value;
            if (model.OwnerId != null)
                _ownerId = model.OwnerId.Value;
            if (model.Region != null)
                Region = Client.GetRegion(model.Region);
            if (model.Icon != null)
                IconId = model.Icon;

            if (model.Roles != null)
            {
                foreach (var x in model.Roles)
                    AddRole(x.Id).Update(x);
            }
        }
Esempio n. 2
0
        internal void Update(Guild model)
        {
            Update(model as GuildReference);

            if (model.AFKTimeout != null)
                AFKTimeout = model.AFKTimeout.Value;
            if (model.JoinedAt != null)
                JoinedAt = model.JoinedAt.Value;
            if (model.OwnerId != null)
                _ownerId = model.OwnerId.Value;
            if (model.Region != null)
                Region = Client.GetRegion(model.Region);
            if (model.Icon != null)
                IconId = model.Icon;
            if (model.Features != null)
                Features = model.Features;
            if (model.Emojis != null)
            {
                CustomEmojis = model.Emojis.Select(x => new Emoji(x.Id)
                {
                    Name = x.Name,
                    IsManaged = x.IsManaged,
                    RequireColons = x.RequireColons,
                    Roles = x.RoleIds.Select(y => GetRole(y)).Where(y => y != null).ToArray()
                }).ToArray();
            }
            if (model.Roles != null)
            {
                foreach (var x in model.Roles)
                    AddRole(x.Id).Update(x);
            }

            //Can be null
            _afkChannelId = model.AFKChannelId;
            SplashId = model.Splash;
        }
Esempio n. 3
0
        internal void Update(Guild model)
        {
            if (model.Name != null)
                Name = model.Name;
            if (model.AFKTimeout != null)
                AFKTimeout = model.AFKTimeout.Value;
            if (model.JoinedAt != null)
                JoinedAt = model.JoinedAt.Value;
            if (model.OwnerId != null)
                _ownerId = model.OwnerId.Value;
            if (model.Region != null)
                Region = Client.GetRegion(model.Region);
            if (model.Icon != null)
                IconId = model.Icon;
            if (model.Features != null)
                Features = model.Features;
            if (model.Roles != null)
            {
                _roles = new ConcurrentDictionary<ulong, Role>(2, model.Roles.Length);
                foreach (var x in model.Roles)
                {
                    var role = AddRole(x.Id);
                    role.Update(x, false);
                }
            }
            if (model.Emojis != null) //Needs Roles
            {
                CustomEmojis = model.Emojis.Select(x => new Emoji(x.Id)
                {
                    Name = x.Name,
                    IsManaged = x.IsManaged,
                    RequireColons = x.RequireColons,
                    Roles = x.RoleIds.Select(y => GetRole(y)).Where(y => y != null).ToArray()
                }).ToArray();
            }

            //Can be null
            _afkChannelId = model.AFKChannelId;
            SplashId = model.Splash;
        }