Class IncomingWebhook
Represents a newly-created webhook, containing its token and standard fields.
public class IncomingWebhook : Webhook, IEntity, ISpanFormattable, IFormattable, IEquatable<Entity>, IJsonModel<JsonWebhook>
- Inheritance
-
IncomingWebhook
- Implements
- Inherited Members
Constructors
IncomingWebhook(JsonWebhook, RestClient)
Represents a newly-created webhook, containing its token and standard fields.
public IncomingWebhook(JsonWebhook jsonModel, RestClient client)
Parameters
jsonModelJsonWebhookclientRestClient
Properties
Token
The token of the newly created webhook.
public string Token { get; }
Property Value
Methods
DeleteMessageAsync(ulong, ulong?, RestRequestProperties?, CancellationToken)
Deletes a previously-sent webhook message permanently.
public Task DeleteMessageAsync(ulong messageId, ulong? threadId = null, RestRequestProperties? properties = null, CancellationToken cancellationToken = default)
Parameters
messageIdulongThe ID of the message to delete.
threadIdulong?The ID of the thread the message is in.
propertiesRestRequestPropertiesOptional properties to customize the request, can be null.
cancellationTokenCancellationTokenA token that can be used to cancel the operation before it completes.
Returns
DeleteWithTokenAsync(RestRequestProperties?, CancellationToken)
Deletes a webhook permanently, using the specified token.
public Task DeleteWithTokenAsync(RestRequestProperties? properties = null, CancellationToken cancellationToken = default)
Parameters
propertiesRestRequestPropertiesOptional properties to customize the request, can be null.
cancellationTokenCancellationTokenA token that can be used to cancel the operation before it completes.
Returns
Remarks
Requires the ManageWebhooks permission, and fires a WebhooksUpdate event.
ExecuteAsync(WebhookMessageProperties, bool, ulong?, bool, RestRequestProperties?, CancellationToken)
Executes a webhook with the given parameters, optionally returning the message result.
public Task<RestMessage?> ExecuteAsync(WebhookMessageProperties message, bool wait = false, ulong? threadId = null, bool withComponents = true, RestRequestProperties? properties = null, CancellationToken cancellationToken = default)
Parameters
messageWebhookMessagePropertiesThe message to send through the webhook.
waitboolIf set, the returned RestMessage will contain the sent message, otherwise null.
threadIdulong?Optional ID of the thread to send the message in, within the webhook's target channel. Can be null.
withComponentsboolWhether to respect the
message's Components.When enabled, allows application-owned webhooks to use all components, and non-owned webhooks to use non-interactive components.
propertiesRestRequestPropertiesOptional properties to customize the request, can be null.
cancellationTokenCancellationTokenA token that can be used to cancel the operation before it completes.
Returns
GetAsync(RestRequestProperties?, CancellationToken)
Retrieves a Webhook object for the given ID.
public Task<IncomingWebhook> GetAsync(RestRequestProperties? properties = null, CancellationToken cancellationToken = default)
Parameters
propertiesRestRequestPropertiesOptional properties to customize the request, can be null.
cancellationTokenCancellationTokenA token that can be used to cancel the operation before it completes.
Returns
GetMessageAsync(ulong, ulong?, RestRequestProperties?, CancellationToken)
Returns a previously-sent webhook message.
public Task<RestMessage> GetMessageAsync(ulong messageId, ulong? threadId = null, RestRequestProperties? properties = null, CancellationToken cancellationToken = default)
Parameters
messageIdulongThe ID of the message to retrieve.
threadIdulong?The ID of the thread the message is in.
propertiesRestRequestPropertiesOptional properties to customize the request, can be null.
cancellationTokenCancellationTokenA token that can be used to cancel the operation before it completes.
Returns
GetWithTokenAsync(RestRequestProperties?, CancellationToken)
Retrieves a Webhook object for the given ID, using the specified webhook token.
public Task<IncomingWebhook> GetWithTokenAsync(RestRequestProperties? properties = null, CancellationToken cancellationToken = default)
Parameters
propertiesRestRequestPropertiesOptional properties to customize the request, can be null.
cancellationTokenCancellationTokenA token that can be used to cancel the operation before it completes.
Returns
Remarks
This endpoint does not require authentication.
ModifyAsync(Action<WebhookOptions>, RestRequestProperties?, CancellationToken)
Modifies a webhook, returning the updated Webhook object on success.
public Task<IncomingWebhook> ModifyAsync(Action<WebhookOptions> action, RestRequestProperties? properties = null, CancellationToken cancellationToken = default)
Parameters
actionAction<WebhookOptions>The modification to perform on the webhook.
propertiesRestRequestPropertiesOptional properties to customize the request, can be null.
cancellationTokenCancellationTokenA token that can be used to cancel the operation before it completes.
Returns
Remarks
Requires the ManageWebhooks permission, and fires a WebhooksUpdate event.
ModifyMessageAsync(ulong, Action<MessageOptions>, ulong?, bool, RestRequestProperties?, CancellationToken)
Modifies a previously-sent webhook message.
public Task<RestMessage> ModifyMessageAsync(ulong messageId, Action<MessageOptions> action, ulong? threadId = null, bool withComponents = true, RestRequestProperties? properties = null, CancellationToken cancellationToken = default)
Parameters
messageIdulongThe ID of the message to modify.
actionAction<MessageOptions>The modification to apply to the message.
threadIdulong?The ID of the thread the message is in.
withComponentsboolWhether to respect the modification's Components.
When enabled, allows application-owned webhooks to use all components, and non-owned webhooks to use non-interactive components.
propertiesRestRequestPropertiesOptional properties to customize the request, can be null.
cancellationTokenCancellationTokenA token that can be used to cancel the operation before it completes.
Returns
ModifyWithTokenAsync(Action<WebhookOptions>, RestRequestProperties?, CancellationToken)
Modifies a webhook using the specified token, returning the updated Webhook object on success.
public Task<IncomingWebhook> ModifyWithTokenAsync(Action<WebhookOptions> action, RestRequestProperties? properties = null, CancellationToken cancellationToken = default)
Parameters
actionAction<WebhookOptions>The modification to perform on the webhook.
propertiesRestRequestPropertiesOptional properties to customize the request, can be null.
cancellationTokenCancellationTokenA token that can be used to cancel the operation before it completes.
Returns
Remarks
Requires the ManageWebhooks permission, and fires a WebhooksUpdate event.
Does not allow modifiying the ChannelId property.
ToClient(WebhookClientConfiguration?)
Creates a usable WebhookClient from the webhook object directly.
public WebhookClient ToClient(WebhookClientConfiguration? configuration = null)
Parameters
configurationWebhookClientConfigurationThe configuration to pass to the client.