Lingo.Api.Webhook (Lingo v0.4.2)

Copy Markdown View Source

Webhooks and the messages they send.

Every function returns {:ok, result}, :ok when Discord sends no body, or {:error, %Lingo.Error{}}. Calls go to the current bot (see Lingo.with_bot/2).

Summary

Functions

Creates a webhook in a channel.

Deletes a webhook.

Deletes a webhook using its token.

Sends a message through a webhook. Pass wait: true to get the message back.

Sends a GitHub event through a webhook. Options: :thread_id and :wait.

Sends a Slack-formatted message through a webhook. Options: :thread_id and :wait.

Fetches a webhook.

Fetches a webhook using its token instead of the bot's.

Lists a channel's webhooks.

Lists a guild's webhooks.

Edits a webhook using its token.

Functions

create(channel_id, params, opts \\ [])

Creates a webhook in a channel.

delete(webhook_id, opts \\ [])

@spec delete(
  Lingo.Api.id(),
  keyword()
) :: Lingo.Api.result()

Deletes a webhook.

delete_message(webhook_id, webhook_token, message_id, opts \\ [])

@spec delete_message(Lingo.Api.id(), String.t(), Lingo.Api.id(), keyword()) ::
  Lingo.Api.result()

Deletes a message a webhook sent.

delete_with_token(webhook_id, webhook_token)

@spec delete_with_token(Lingo.Api.id(), String.t()) :: Lingo.Api.result()

Deletes a webhook using its token.

execute(webhook_id, webhook_token, params, opts \\ [])

Sends a message through a webhook. Pass wait: true to get the message back.

execute_github(webhook_id, webhook_token, params, opts \\ [])

@spec execute_github(Lingo.Api.id(), String.t(), Lingo.Api.params(), keyword()) ::
  Lingo.Api.result()

Sends a GitHub event through a webhook. Options: :thread_id and :wait.

execute_slack(webhook_id, webhook_token, params, opts \\ [])

@spec execute_slack(Lingo.Api.id(), String.t(), Lingo.Api.params(), keyword()) ::
  Lingo.Api.result()

Sends a Slack-formatted message through a webhook. Options: :thread_id and :wait.

get(webhook_id)

Fetches a webhook.

get_message(webhook_id, webhook_token, message_id, opts \\ [])

Fetches a message a webhook sent.

get_with_token(webhook_id, webhook_token)

@spec get_with_token(Lingo.Api.id(), String.t()) ::
  Lingo.Api.result(Lingo.Type.Webhook.t())

Fetches a webhook using its token instead of the bot's.

list_channel(channel_id)

@spec list_channel(Lingo.Api.id()) :: Lingo.Api.result([Lingo.Type.Webhook.t()])

Lists a channel's webhooks.

list_guild(guild_id)

@spec list_guild(Lingo.Api.id()) :: Lingo.Api.result([Lingo.Type.Webhook.t()])

Lists a guild's webhooks.

update(webhook_id, params, opts \\ [])

Edits a webhook.

update_message(webhook_id, webhook_token, message_id, params, opts \\ [])

Edits a message a webhook sent.

update_with_token(webhook_id, webhook_token, params)

Edits a webhook using its token.