seyfert
    Preparing search index...

    Class Webhook

    Represents a Discord webhook.

    Hierarchy

    • DiscordBase
    • ObjectToLower<Omit<APIWebhook, "user" | "source_guild">>
      • Webhook
    Index

    Constructors

    Properties

    applicationId: null | string
    avatar: null | string
    channelId: string
    client: UsingClient
    guildId?: string
    id: string
    messages: {
        delete: (messageId: string, reason?: string) => Promise<undefined>;
        edit: (
            payload: {
                body: Omit<
                    RESTPatchAPIWebhookWithTokenMessageJSONBody,
                    "components"
                    | "content"
                    | "embeds"
                    | "poll",
                > & ResolverProps;
                messageId: string;
                query?: RESTPatchAPIWebhookWithTokenMessageQuery;
            },
        ) => Promise<WebhookMessage>;
        write: (
            payload: {
                body: Omit<
                    RESTPostAPIWebhookWithTokenJSONBody,
                    "components"
                    | "content"
                    | "embeds"
                    | "poll",
                > & SendResolverProps;
                query?: RESTPostAPIWebhookWithTokenQuery;
            },
        ) => Promise<null | WebhookMessage>;
    }

    Methods related to interacting with messages through the webhook.

    Type declaration

    • delete: (messageId: string, reason?: string) => Promise<undefined>

      Deletes a message sent through the webhook.

    • edit: (
          payload: {
              body: Omit<
                  RESTPatchAPIWebhookWithTokenMessageJSONBody,
                  "components"
                  | "content"
                  | "embeds"
                  | "poll",
              > & ResolverProps;
              messageId: string;
              query?: RESTPatchAPIWebhookWithTokenMessageQuery;
          },
      ) => Promise<WebhookMessage>

      Edits a message sent through the webhook.

    • write: (
          payload: {
              body: Omit<
                  RESTPostAPIWebhookWithTokenJSONBody,
                  "components"
                  | "content"
                  | "embeds"
                  | "poll",
              > & SendResolverProps;
              query?: RESTPostAPIWebhookWithTokenQuery;
          },
      ) => Promise<null | WebhookMessage>

      Writes a message through the webhook.

    name: null | string
    sourceChannel?: { id: string; name?: null | string; type: ChannelType }
    sourceGuild?: Partial<AnonymousGuild>

    The source guild of the webhook, if applicable.

    token?: string
    type: WebhookType
    url?: string
    user?: User

    The user associated with the webhook, if applicable.

    Accessors

    Methods

    • Retrieves the avatar URL of the webhook.

      Parameters

      Returns null | string

      The avatar URL of the webhook, or null if no avatar is set.

    • Fetches the channel associated with the webhook.

      Parameters

      • Optionalmode: "rest" | "flow"

      Returns Promise<AllChannels>

      A promise that resolves to the channel associated with the webhook, or undefined if not applicable.

    • Fetches the channel associated with the webhook.

      Parameters

      • mode: "cache"

      Returns ReturnCache<undefined | AllChannels>

      A promise that resolves to the channel associated with the webhook, or undefined if not applicable.

    • Deletes the webhook.

      Parameters

      • Optionalreason: string

        The reason for deleting the webhook.

      Returns Promise<undefined>

      A promise that resolves when the webhook is successfully deleted.

    • Edits the webhook.

      Parameters

      • body: RESTPatchAPIWebhookJSONBody | RESTPatchAPIWebhookWithTokenJSONBody

        The new webhook data.

      • Optionalreason: string

        The reason for editing the webhook.

      Returns Promise<Webhook>

      A promise that resolves when the webhook is successfully edited.

    • Fetches the guild associated with the webhook.

      Parameters

      • Optionalmode: "rest" | "flow"

      Returns Promise<undefined | Guild<"cached" | "api">>

      A promise that resolves to the guild associated with the webhook, or undefined if not applicable.

    • Fetches the guild associated with the webhook.

      Parameters

      • mode: "cache"

      Returns ReturnCache<undefined | Guild<"cached">>

      A promise that resolves to the guild associated with the webhook, or undefined if not applicable.

    • Static methods related to interacting with messages through webhooks.

      Parameters

      • __namedParameters: { client: UsingClient; webhookId: string; webhookToken: string }

      Returns {
          delete: (messageId: string, reason?: string) => Promise<undefined>;
          edit: (
              payload: {
                  body: Omit<
                      RESTPatchAPIWebhookWithTokenMessageJSONBody,
                      "components"
                      | "content"
                      | "embeds"
                      | "poll",
                  > & ResolverProps;
                  messageId: string;
                  query?: RESTPatchAPIWebhookWithTokenMessageQuery;
              },
          ) => Promise<WebhookMessage>;
          write: (
              payload: {
                  body: Omit<
                      RESTPostAPIWebhookWithTokenJSONBody,
                      "components"
                      | "content"
                      | "embeds"
                      | "poll",
                  > & SendResolverProps;
                  query?: RESTPostAPIWebhookWithTokenQuery;
              },
          ) => Promise<null | WebhookMessage>;
      }

      • delete: (messageId: string, reason?: string) => Promise<undefined>

        Deletes a message sent through the webhook.

      • edit: (
            payload: {
                body: Omit<
                    RESTPatchAPIWebhookWithTokenMessageJSONBody,
                    "components"
                    | "content"
                    | "embeds"
                    | "poll",
                > & ResolverProps;
                messageId: string;
                query?: RESTPatchAPIWebhookWithTokenMessageQuery;
            },
        ) => Promise<WebhookMessage>

        Edits a message sent through the webhook.

      • write: (
            payload: {
                body: Omit<
                    RESTPostAPIWebhookWithTokenJSONBody,
                    "components"
                    | "content"
                    | "embeds"
                    | "poll",
                > & SendResolverProps;
                query?: RESTPostAPIWebhookWithTokenQuery;
            },
        ) => Promise<null | WebhookMessage>

        Writes a message through the webhook.

    • Static methods related to managing webhooks.

      Parameters

      • __namedParameters: { client: UsingClient; webhookId: string; webhookToken?: string }

      Returns {
          delete: (reason?: string) => Promise<undefined>;
          edit: (
              body:
                  | RESTPatchAPIWebhookJSONBody
                  | RESTPatchAPIWebhookWithTokenJSONBody,
              reason?: string,
          ) => Promise<Webhook>;
          fetch: () => Promise<Webhook>;
      }

      • delete: (reason?: string) => Promise<undefined>

        Deletes the webhook.

      • edit: (
            body: RESTPatchAPIWebhookJSONBody | RESTPatchAPIWebhookWithTokenJSONBody,
            reason?: string,
        ) => Promise<Webhook>

        Edits the webhook.

      • fetch: () => Promise<Webhook>

        Fetches the webhook data from the Discord API.