Documentation ¶
Overview ¶
Package webhook provides means to interact with webhooks directly and not through the bot API.
Index ¶
- Variables
- func Delete(id discord.WebhookID, token string) error
- func Execute(id discord.WebhookID, token string, data api.ExecuteWebhookData) error
- func ExecuteAndWait(id discord.WebhookID, token string, data api.ExecuteWebhookData) (*discord.Message, error)
- func Get(id discord.WebhookID, token string) (*discord.Webhook, error)
- func Modify(id discord.WebhookID, token string, data api.ModifyWebhookData) (*discord.Webhook, error)
- type Client
- func (c *Client) Delete() error
- func (c *Client) Execute(data api.ExecuteWebhookData) (err error)
- func (c *Client) ExecuteAndWait(data api.ExecuteWebhookData) (*discord.Message, error)
- func (c *Client) Get() (*discord.Webhook, error)
- func (c *Client) Modify(data api.ModifyWebhookData) (*discord.Webhook, error)
Constants ¶
This section is empty.
Variables ¶
var DefaultHTTPClient = httputil.NewClient()
DefaultHTTPClient is the httputil.Client used in the helper methods.
Functions ¶
func Execute ¶
Execute is a shortcut for NewCustomClient(token, id, DefaultHTTPClient).Execute(data).
func ExecuteAndWait ¶
func ExecuteAndWait( id discord.WebhookID, token string, data api.ExecuteWebhookData) (*discord.Message, error)
ExecuteAndWait is a shortcut for NewCustomClient(token, id, DefaultHTTPClient).ExecuteAndWait(data).
Types ¶
type Client ¶
type Client struct { // Client is the httputil.Client used to call Discord's API. *httputil.Client // ID is the id of the webhook. ID discord.WebhookID // Token is the token of the webhook. Token string }
Client is the client used to interact with a webhook.
func NewCustomClient ¶
NewCustomClient creates a new Client creates a new Client using the passed token and id and makes API calls using the passed httputil.Client
func (*Client) Execute ¶
func (c *Client) Execute(data api.ExecuteWebhookData) (err error)
Execute sends a message to the webhook, but doesn't wait for the message to get created. This is generally faster, but only applicable if no further interaction is required.
func (*Client) ExecuteAndWait ¶
ExecuteAndWait executes the webhook, and waits for the generated discord.Message to be returned.