Method ExecuteWebhook
| Improve this Doc View SourceExecuteWebhook(Snowflake, string, ExecuteWebhookOptions, bool)
Executes a webhook.
Note: Returns null unless waitAndReturnMessage is set to true.
Declaration
public Task<DiscordMessage?> ExecuteWebhook(Snowflake webhookId, string token, ExecuteWebhookOptions options, bool waitAndReturnMessage = false)
Parameters
| Type | Name | Description |
|---|---|---|
| Snowflake | webhookId | The ID of the webhook to execute. |
| string | token | The webhook's token. |
| ExecuteWebhookOptions | options | |
| bool | waitAndReturnMessage | Whether to wait for the message to be created and have it returned from this method. |
Returns
| Type | Description |
|---|---|
| Task<DiscordMessage> |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Thrown if the token is empty or only contains whitespace characters. |
| ArgumentNullException | Thrown if the token or |
| DiscordHttpApiException |
ExecuteWebhook(DiscordWebhook, string, ExecuteWebhookOptions, bool)
Executes a webhook.
Note: Returns null unless waitAndReturnMessage is set to true.
Declaration
public Task<DiscordMessage?> ExecuteWebhook(DiscordWebhook webhook, string token, ExecuteWebhookOptions options, bool waitAndReturnMessage = false)
Parameters
| Type | Name | Description |
|---|---|---|
| DiscordWebhook | webhook | The webhook to execute. |
| string | token | The webhook's token. |
| ExecuteWebhookOptions | options | |
| bool | waitAndReturnMessage | Whether to wait for the message to be created and have it returned from this method. |
Returns
| Type | Description |
|---|---|
| Task<DiscordMessage> |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Thrown if the token is empty or only contains whitespace characters. |
| ArgumentNullException | Thrown if |
| DiscordHttpApiException |
ExecuteWebhook(Snowflake, string, Stream, string, ExecuteWebhookOptions?, bool)
Executes a webhook with a file attachment.
Note: Returns null unless waitAndReturnMessage is set to true.
Declaration
public Task<DiscordMessage?> ExecuteWebhook(Snowflake webhookId, string token, Stream fileData, string fileName, ExecuteWebhookOptions? options = null, bool waitAndReturnMessage = false)
Parameters
| Type | Name | Description |
|---|---|---|
| Snowflake | webhookId | The ID of the webhook to execute. |
| string | token | The webhook's token. |
| Stream | fileData | |
| string | fileName | |
| ExecuteWebhookOptions | options | |
| bool | waitAndReturnMessage | Whether to wait for the message to be created and have it returned from this method. |
Returns
| Type | Description |
|---|---|
| Task<DiscordMessage> |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Thrown if the token is empty or only contains whitespace characters. |
| ArgumentNullException | Thrown if the token is null,
or |
| DiscordHttpApiException |
ExecuteWebhook(DiscordWebhook, string, Stream, string, ExecuteWebhookOptions?, bool)
Executes a webhook with a file attachment.
Note: Returns null unless waitAndReturnMessage is set to true.
Declaration
public Task<DiscordMessage?> ExecuteWebhook(DiscordWebhook webhook, string token, Stream fileData, string fileName, ExecuteWebhookOptions? options = null, bool waitAndReturnMessage = false)
Parameters
| Type | Name | Description |
|---|---|---|
| DiscordWebhook | webhook | The webhook to execute. |
| string | token | The webhook's token. |
| Stream | fileData | |
| string | fileName | |
| ExecuteWebhookOptions | options | |
| bool | waitAndReturnMessage | Whether to wait for the message to be created and have it returned from this method. |
Returns
| Type | Description |
|---|---|
| Task<DiscordMessage> |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Thrown if the token is empty or only contains whitespace characters. |
| ArgumentNullException | Thrown if |
| DiscordHttpApiException |
ExecuteWebhook(Snowflake, string, ArraySegment<byte>, string, ExecuteWebhookOptions?, bool)
Executes a webhook with a file attachment.
Note: Returns null unless waitAndReturnMessage is set to true.
Declaration
public Task<DiscordMessage?> ExecuteWebhook(Snowflake webhookId, string token, ArraySegment<byte> fileData, string fileName, ExecuteWebhookOptions? options = null, bool waitAndReturnMessage = false)
Parameters
| Type | Name | Description |
|---|---|---|
| Snowflake | webhookId | The ID of the webhook to execute. |
| string | token | The webhook's token. |
| ArraySegment<byte> | fileData | |
| string | fileName | |
| ExecuteWebhookOptions | options | |
| bool | waitAndReturnMessage | Whether to wait for the message to be created and have it returned from this method. |
Returns
| Type | Description |
|---|---|
| Task<DiscordMessage> |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Thrown if the token is empty or only contains whitespace characters. Also thrown if fileData.Array is null. |
| ArgumentNullException | Thrown if the token is null or the file name is null, empty, or only contains whitespace characters. |
| DiscordHttpApiException |
ExecuteWebhook(DiscordWebhook, string, ArraySegment<byte>, string, ExecuteWebhookOptions?, bool)
Executes a webhook with a file attachment.
Note: Returns null unless waitAndReturnMessage is set to true.
Declaration
public Task<DiscordMessage?> ExecuteWebhook(DiscordWebhook webhook, string token, ArraySegment<byte> fileData, string fileName, ExecuteWebhookOptions? options = null, bool waitAndReturnMessage = false)
Parameters
| Type | Name | Description |
|---|---|---|
| DiscordWebhook | webhook | The webhook to execute. |
| string | token | The webhook's token. |
| ArraySegment<byte> | fileData | |
| string | fileName | |
| ExecuteWebhookOptions | options | |
| bool | waitAndReturnMessage | Whether to wait for the message to be created and have it returned from this method. |
Returns
| Type | Description |
|---|---|
| Task<DiscordMessage> |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Thrown if the token is empty or only contains whitespace characters. |
| ArgumentNullException | Thrown if |
| DiscordHttpApiException |