Webhook endpoints.
execute/3 needs no bot token — the webhook token in the URL is the credential.
Treat webhook URLs as secrets.
Summary
Functions
POST /channels/{channel.id}/webhooks — create a webhook. params: %{name, avatar}.
Accepts :reason (audit log).
POST /webhooks/{webhook.id}/{webhook.token} — execute a webhook.
GET /channels/{channel.id}/webhooks — the channel's webhooks.
Parses a webhook URL or {id, token} into {:ok, {id, token}}.
Types
Functions
@spec create(Noizu.Discord.Client.t(), String.t(), map(), keyword()) :: Noizu.Discord.Request.result()
POST /channels/{channel.id}/webhooks — create a webhook. params: %{name, avatar}.
Accepts :reason (audit log).
@spec execute(target(), map(), keyword()) :: Noizu.Discord.Request.result()
POST /webhooks/{webhook.id}/{webhook.token} — execute a webhook.
target is a full webhook URL (https://discord.com/api/webhooks/<id>/<token>) or
an {id, token} tuple. params: %{content, embeds, username, avatar_url, thread_id, allowed_mentions, components, thread_name, flags} — thread_id is sent
as a query parameter as Discord requires.
Opts:
:wait— defaulttrue(Discord returns the created message);falsereturns{:ok, nil}.:client— aNoizu.Discord.Clientwhosebase_url,user_agent,req_optionsandretryare used (its token is never sent). Without it a client is built from:base_url/:req_options/:retryopts.:meta.
The request always goes to the client's base_url; only id + token are taken
from a URL target.
@spec list_channel(Noizu.Discord.Client.t(), String.t(), keyword()) :: Noizu.Discord.Request.result()
GET /channels/{channel.id}/webhooks — the channel's webhooks.
@spec parse_target(target()) :: {:ok, {String.t(), String.t()}} | {:error, Noizu.Discord.Error.t()}
Parses a webhook URL or {id, token} into {:ok, {id, token}}.