コード例 #1
0
        public static ModifyGuildScheduledEventJsonRestRequestContent ToContent(this Action <ModifyGuildEventActionProperties> action)
        {
            Guard.IsNotNull(action);

            var properties = new ModifyGuildEventActionProperties();

            action(properties);

            var content = new ModifyGuildScheduledEventJsonRestRequestContent
            {
                ChannelId          = properties.ChannelId,
                Name               = properties.Name,
                PrivacyLevel       = properties.PrivacyLevel,
                ScheduledStartTime = properties.StartsAt,
                ScheduledEndTime   = properties.EndsAt,
                Description        = properties.Description,
                EntityType         = properties.TargetType,
                Status             = properties.Status,
                Image              = properties.CoverImage
            };

            if (properties.Location.HasValue)
            {
                content.EntityMetadata = new GuildScheduledEventEntityMetadataJsonModel
                {
                    Location = properties.Location.Value
                };
            }

            return(content);
        }
コード例 #2
0
        public static Task <GuildScheduledEventJsonModel> ModifyGuildScheduledEventAsync(this IRestApiClient client,
                                                                                         Snowflake guildId, Snowflake eventId, ModifyGuildScheduledEventJsonRestRequestContent content,
                                                                                         IRestRequestOptions options = null, CancellationToken cancellationToken = default)
        {
            var route = Format(Route.GuildEvents.ModifyEvent, guildId, eventId);

            return(client.ExecuteAsync <GuildScheduledEventJsonModel>(route, content, options, cancellationToken));
        }