Discore
Show / Hide Table of Contents

Method ExecuteWebhook

| Improve this Doc View Source

ExecuteWebhook(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 options is null.

DiscordHttpApiException
| Improve this Doc View Source

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 webhook, the token, or options is null.

DiscordHttpApiException
| Improve this Doc View Source

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 fileData is null, or the file name is null, empty, or only contains whitespace characters.

DiscordHttpApiException
| Improve this Doc View Source

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 webhook, the token, or fileData is null, or the file name is null, empty, or only contains whitespace characters.

DiscordHttpApiException
| Improve this Doc View Source

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
| Improve this Doc View Source

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 webhook, the token, or the file name is null, empty, or only contains whitespace characters.

DiscordHttpApiException
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX