Class Dishook
Contains simpler but less flexible wrapper methods for sending messages to Discord. Consider using the Webhook class instead, which this class uses internally.
Inheritance
Namespace: Dishooks
Assembly: cs.temp.dll.dll
Syntax
public class Dishook : MonoBehaviour
Fields
DefaultUrl
The default channel to send messages to if none is specified. !!! Remember to change this to a channel you have created !!!
Declaration
public const string DefaultUrl = "https://discord.com/api/webhooks/730533481892806767/aPKOoEoamLq9pVnKHT3gF-whSrtrsnkWlOA3xPQPMNBsK5vhe9PC82-e7bu3BEFEPeir"
Field Value
Type | Description |
---|---|
System.String |
Methods
Delete(DiscordMessage, Action<DiscordError>)
Declaration
public static IEnumerator Delete(DiscordMessage message, Action<DiscordError> callback = null)
Parameters
Type | Name | Description |
---|---|---|
DiscordMessage | message | |
Action<DiscordError> | callback |
Returns
Type | Description |
---|---|
IEnumerator |
Patch(Webhook, DiscordMessage, Action<DiscordError, DiscordMessage>)
Declaration
public static IEnumerator Patch(Webhook webhook, DiscordMessage message, Action<DiscordError, DiscordMessage> callback = null)
Parameters
Type | Name | Description |
---|---|---|
Webhook | webhook | |
DiscordMessage | message | |
Action<DiscordError, DiscordMessage> | callback |
Returns
Type | Description |
---|---|
IEnumerator |
Post(Webhook, Action<DiscordError, DiscordMessage>)
Declaration
public static IEnumerator Post(Webhook webhook, Action<DiscordError, DiscordMessage> callback = null)
Parameters
Type | Name | Description |
---|---|---|
Webhook | webhook | |
Action<DiscordError, DiscordMessage> | callback |
Returns
Type | Description |
---|---|
IEnumerator |
Post(String, Webhook, Action<DiscordError, DiscordMessage>)
POST your content to a Discord channel. This is the main method used by the Webhook class.
Declaration
public static IEnumerator Post(string url, Webhook webhook, Action<DiscordError, DiscordMessage> callback = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | url | The webhook URL. |
Webhook | webhook | The webhook object. |
Action<DiscordError, DiscordMessage> | callback | An optional callback that will be called when the request is finished. |
Returns
Type | Description |
---|---|
IEnumerator |
Send(String, DishookItem)
Sends a message to your channel. This is a super simple wrapper to send basic text, use the Webhook class for more advanced features.
Declaration
public static void Send(string msg, DishookItem hook)
Parameters
Type | Name | Description |
---|---|---|
System.String | msg | The message you want to send. Default discord emotes and formatting supported. |
DishookItem | hook | Webhook item created earlier, see the readme file. |
Send(String, String, String, String)
Sends a message to your channel. This is a super simple wrapper to send basic text, use the Webhook class for more advanced features.
Declaration
public static void Send(string msg, string name = null, string avatar = null, string url = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | msg | The message you want to send. Discord emotes and formatting is supported. |
System.String | name | Username that sends the webhook. If this is null, the Webhook name on Discord will be used. |
System.String | avatar | Link to the senders profile picture. If this is null, the Webhook avatar on Discord will be used. |
System.String | url | Link to the webhook. If this is null, the default Dishook URL will be used. |