public static Task <MessageJsonModel> ExecuteWebhookAsync(this IRestApiClient client, Snowflake webhookId, string token, ExecuteWebhookJsonRestRequestContent content, bool wait = false, IRestRequestOptions options = null)
        {
            // TODO: query param utility
            var route = Format(Route.Webhook.ExecuteWebhook, new[] { KeyValuePair.Create("wait", (object)wait) }, webhookId, token);

            return(client.ExecuteAsync <MessageJsonModel>(route, content, options));
        }
예제 #2
0
        public static Task <MessageJsonModel> ExecuteWebhookAsync(this IRestApiClient client,
                                                                  Snowflake webhookId, string token, ExecuteWebhookJsonRestRequestContent content,
                                                                  Snowflake?threadId          = null, bool wait = false,
                                                                  IRestRequestOptions options = null, CancellationToken cancellationToken = default)
        {
            // TODO: query param utility
            var queryParameters = new KeyValuePair <string, object> [threadId != null ? 2: 1];

            queryParameters[0] = KeyValuePair.Create("wait", (object)wait);

            if (threadId != null)
            {
                queryParameters[1] = new("thread_id", threadId.Value);
            }

            var route = Format(Route.Webhook.ExecuteWebhook, queryParameters, webhookId, token);

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