Class Webhook
A Webhook object contains all the information needed to send a webhook to a Discord channel. This is the main class of the library, and is always required to send a webhook.
Inheritance
Inherited Members
Namespace: Dishooks
Assembly: cs.temp.dll.dll
Syntax
public class Webhook
Constructors
Webhook()
Create a new empty webhook, using the default URL, username and avatar.
Declaration
public Webhook()
Webhook(DishookItem)
Create a new empty webhook from a DishookItem.
Declaration
public Webhook(DishookItem item)
Parameters
Type | Name | Description |
---|---|---|
DishookItem | item | The DishookItem to get the information from. |
Webhook(String)
Create a new empty webhook with a custom URL, using the default username and avatar.
Declaration
public Webhook(string url)
Parameters
Type | Name | Description |
---|---|---|
System.String | url | The webhook URL to use. |
Properties
Attachments
Up to 10 Attachment objects that will be sent with the message.
Declaration
public Attachment[] Attachments { get; set; }
Property Value
Type | Description |
---|---|
Attachment[] |
AvatarUrl
Override the default avatar of the webhook. If this is missing, the default avatar is the webhook's default avatar in Discord.
Declaration
public string AvatarUrl { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Content
The message text contents. This can be up to 2000 characters long, and will be truncated if it is longer.
Declaration
public string Content { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Embeds
Up to 10 Embed objects that will be sent with the message.
Declaration
public Embed[] Embeds { get; set; }
Property Value
Type | Description |
---|---|
Embed[] |
Tts
Whether or not this is a TTS message. Only users who have enabled playback and usage of the /tts command in Discord will be able to hear the message.
Declaration
public bool? Tts { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<System.Boolean> |
URL
The URL to the webhook. If empty or null, the webhook will be sent to the default webhook.
Declaration
public string URL { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Username
Override the default username of the webhook. If this is missing, the default username is the webhook's name in Discord.
The username must follow the nickname guidelines, with an exception that webhook names can be up to 80 characters long.
Declaration
public string Username { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Methods
AddAttachment(Attachment)
Adds an Attachment to the webhook. Max 10.
Declaration
public bool AddAttachment(Attachment attachment)
Parameters
Type | Name | Description |
---|---|---|
Attachment | attachment | The attachment to add. |
Returns
Type | Description |
---|---|
System.Boolean | True if the attachment was added, otherwise false. |
AddEmbed(Embed)
Adds an
Declaration
public bool AddEmbed(Embed embed)
Parameters
Type | Name | Description |
---|---|---|
Embed | embed | The embed to add. |
Returns
Type | Description |
---|---|
System.Boolean | True if the embed was added, otherwise false. |
Send()
Execute and send this webhook to Discord. Webhooks sent with this method will NOT be editable or deletable from Unity.
Declaration
public void Send()
SetConfiguration(DishookItem)
Override the name, avatar and URL of the webhook with a DishookItem.
Declaration
public void SetConfiguration(DishookItem item)
Parameters
Type | Name | Description |
---|---|---|
DishookItem | item | The DishookItem to use. |
ToForm()
Convert the webhook to a
Declaration
public WWWForm ToForm()
Returns
Type | Description |
---|---|
WWWForm | The |
ToString()
Serialize the webhook to a JSON string
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String | The JSON string |