/// <summary> /// Executes this webhook, i.e. sends a message from it. /// </summary> /// <param name="client"> The webhook client. </param> /// <param name="message"> The message to send. </param> /// <param name="threadId"> The ID of the thread (within the webhook's channel) in which this request should be performed. </param> /// <param name="wait"> Whether the API should return the sent message object. </param> /// <param name="options"> The optional request options. </param> /// <param name="cancellationToken"> The cancellation token to observe. </param> /// <returns> /// A <see cref="Task{TResult}"/> representing the asynchronous request /// that wraps the returned <see cref="IUserMessage"/> if <paramref name="wait"/> is <see langword="true"/>. /// </returns> public static Task <IUserMessage> ExecuteAsync(this IWebhookClient client, LocalWebhookMessage message, Snowflake?threadId = null, bool wait = false, IRestRequestOptions options = null, CancellationToken cancellationToken = default) { return(client.RestClient.ExecuteWebhookAsync(client.Id, client.Token, message, threadId, wait, options, cancellationToken)); }
public static Task <IUserMessage> ExecuteAsync(this IWebhook webhook, LocalWebhookMessage message, bool wait = false, IRestRequestOptions options = null) { var client = webhook.GetRestClient(); return(client.ExecuteWebhookAsync(webhook.Id, webhook.Token, message, wait, options)); }
private LocalWebhookMessage(LocalWebhookMessage other) : base(other) { Name = other.Name; AvatarUrl = other.AvatarUrl; }
/// <summary> /// Executes this webhook, i.e. sends a message from it. /// </summary> /// <param name="client"> The webhook client. </param> /// <param name="message"> The message to send. </param> /// <param name="wait"> Whether the API should return a message. </param> /// <param name="options"> The optional request options. </param> /// <returns> /// A <see cref="Task{TResult}"/> representing the asynchronous request /// that wraps the returned <see cref="IUserMessage"/> if <paramref name="wait"/> is <see langword="true"/>. /// </returns> public static Task <IUserMessage> ExecuteAsync(this IWebhookClient client, LocalWebhookMessage message, bool wait = false, IRestRequestOptions options = null) => client.RestClient.ExecuteWebhookAsync(client.Id, client.Token, message, wait, options);