예제 #1
0
        public static async Task <Model> ModifyAsync(IGuildChannel channel, BaseDiscordClient client,
                                                     Action <GuildChannelProperties> func,
                                                     RequestOptions options)
        {
            var args = new GuildChannelProperties();

            func(args);
            var apiArgs = new API.Rest.ModifyGuildChannelParams
            {
                Name       = args.Name,
                Position   = args.Position,
                CategoryId = args.CategoryId,
                Overwrites = args.PermissionOverwrites.IsSpecified
                    ? args.PermissionOverwrites.Value.Select(overwrite => new API.Overwrite
                {
                    TargetId   = overwrite.TargetId,
                    TargetType = overwrite.TargetType,
                    Allow      = overwrite.Permissions.AllowValue.ToString(),
                    Deny       = overwrite.Permissions.DenyValue.ToString()
                }).ToArray()
                    : Optional.Create <API.Overwrite[]>(),
            };

            return(await client.ApiClient.ModifyGuildChannelAsync(channel.Id, apiArgs, options).ConfigureAwait(false));
        }
예제 #2
0
        public static async Task <Model> ModifyAsync(IGuildChannel channel, BaseDiscordClient client,
                                                     Action <GuildChannelProperties> func,
                                                     RequestOptions options)
        {
            var args = new GuildChannelProperties();

            func(args);
            var apiArgs = new API.Rest.ModifyGuildChannelParams
            {
                Name     = args.Name,
                Position = args.Position
            };

            return(await client.ApiClient.ModifyGuildChannelAsync(channel.Id, apiArgs, options).ConfigureAwait(false));
        }