コード例 #1
0
        private void Update(ModifyGuildMemberParams args, UpdateSource source)
        {
            if (source == UpdateSource.Rest && IsAttached)
            {
                return;
            }

            if (args._roleIds.IsSpecified)
            {
                Roles = args._roleIds.Value.Select(x => Guild.GetRole(x)).Where(x => x != null).ToImmutableArray();
            }
            if (args._nickname.IsSpecified)
            {
                Nickname = args._nickname.Value ?? "";
            }
        }
コード例 #2
0
        private void UpdateRoles(ulong[] roleIds)
        {
            var roles = ImmutableArray.CreateBuilder <Role>(roleIds.Length + 1);

            roles.Add(Guild.EveryoneRole);
            for (int i = 0; i < roleIds.Length; i++)
            {
                var role = Guild.GetRole(roleIds[i]);
                if (role != null)
                {
                    roles.Add(role);
                }
            }
            Roles            = roles.ToImmutable();
            GuildPermissions = new GuildPermissions(Permissions.ResolveGuild(this));
        }
コード例 #3
0
ファイル: GuildIntegration.cs プロジェクト: faulty15/Faulty
        public void Update(Model model, UpdateSource source)
        {
            if (source == UpdateSource.Rest && IsAttached)
            {
                return;
            }

            Name              = model.Name;
            Type              = model.Type;
            IsEnabled         = model.Enabled;
            IsSyncing         = model.Syncing;
            ExpireBehavior    = model.ExpireBehavior;
            ExpireGracePeriod = model.ExpireGracePeriod;
            _syncedAtTicks    = model.SyncedAt.UtcTicks;

            Role = Guild.GetRole(model.RoleId);
            User = new User(model.User);
        }