Skip to content

Webhook

Represents a Discord webhook.

Extends

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

Constructors

new Webhook(client, data)

1
new Webhook(client: UsingClient, data: APIWebhook): Webhook

Constructs a new Webhook instance.

Parameters

ParameterTypeDescription
clientUsingClientThe Discord client instance.
dataAPIWebhookThe data representing the webhook.

Returns

Webhook

Inherited from

DiscordBase.constructor

Source

seyfert/src/structures/Webhook.ts:41

Properties

PropertyModifierTypeDescriptionInherited from
applicationIdpublicnull | string-ObjectToLower.applicationId
avatarpublicnull | string-ObjectToLower.avatar
channelIdpublicstring-ObjectToLower.channelId
clientreadonlyUsingClient-DiscordBase.client
guildIdpublicundefined | string-ObjectToLower.guildId
idpublicstring-DiscordBase.id
messagespublicObjectMethods related to interacting with messages through the webhook.-
messages.deletepublic(messageId: string, reason?: string) => Promise<never>Deletes a message sent through the webhook.-
messages.editpublic(payload: Object) => Promise<WebhookMessage>Edits a message sent through the webhook.-
messages.writepublic(payload: Object) => Promise<null | WebhookMessage>Writes a message through the webhook.-
namepublicnull | string-ObjectToLower.name
sourceChannelpublicundefined | Object-ObjectToLower.sourceChannel
sourceGuild?publicPartial<AnonymousGuild>The source guild of the webhook, if applicable.-
tokenpublicundefined | string-ObjectToLower.token
typepublicWebhookType-ObjectToLower.type
urlpublicundefined | string-ObjectToLower.url
user?publicUserThe user associated with the webhook, if applicable.-

Accessors

createdAt

1
get createdAt(): Date

createdAt gets the creation Date instace of the current object.

Returns

Date

Source

seyfert/src/structures/extra/DiscordBase.ts:27


createdTimestamp

1
get createdTimestamp(): number

Create a timestamp for the current object.

Returns

number

Source

seyfert/src/structures/extra/DiscordBase.ts:20

Methods

avatarURL()

1
avatarURL(options?: CDNUrlOptions): null | string

Retrieves the avatar URL of the webhook.

Parameters

ParameterTypeDescription
options?CDNUrlOptionsThe image options for the avatar.

Returns

null | string

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

Source

seyfert/src/structures/Webhook.ts:82


channel()

1
channel(force: boolean): Promise<undefined | BaseChannel<ChannelType> | DMChannel | CategoryChannel>

Fetches the channel associated with the webhook.

Parameters

ParameterTypeDefault valueDescription
forcebooleanfalseWhether to force fetching the channel even if it’s already cached.

Returns

Promise<undefined | BaseChannel<ChannelType> | DMChannel | CategoryChannel>

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

Source

seyfert/src/structures/Webhook.ts:72


delete()

1
delete(reason?: string): Promise<never>

Deletes the webhook.

Parameters

ParameterTypeDescription
reason?stringThe reason for deleting the webhook.

Returns

Promise<never>

A promise that resolves when the webhook is successfully deleted.

Source

seyfert/src/structures/Webhook.ts:113


edit()

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

Edits the webhook.

Parameters

ParameterTypeDescription
bodyRESTPatchAPIWebhookJSONBody | RESTPatchAPIWebhookWithTokenJSONBodyThe new webhook data.
reason?stringThe reason for editing the webhook.

Returns

Promise<Webhook>

A promise that resolves when the webhook is successfully edited.

Source

seyfert/src/structures/Webhook.ts:104


fetch()

1
fetch(): Promise<Webhook>

Fetches the webhook data from the Discord API.

Returns

Promise<Webhook>

A promise that resolves to the fetched webhook data.

Source

seyfert/src/structures/Webhook.ts:94


guild()

1
guild(force: boolean): undefined | Promise<Guild<"cached"> | Guild<"api">>

Fetches the guild associated with the webhook.

Parameters

ParameterTypeDefault valueDescription
forcebooleanfalseWhether to force fetching the guild even if it’s already cached.

Returns

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

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

Source

seyfert/src/structures/Webhook.ts:62


messages()

1
static messages(__namedParameters: Object): Object

Static methods related to interacting with messages through webhooks.

Parameters

ParameterType
__namedParametersObject
__namedParameters.clientUsingClient
__namedParameters.webhookIdstring
__namedParameters.webhookTokenstring

Returns

Object

MemberTypeValueDescription
delete(messageId: string, reason?: string) => Promise<never>-Deletes a message sent through the webhook.
edit(payload: Object) => Promise<WebhookMessage>-Edits a message sent through the webhook.
write(payload: Object) => Promise<null | WebhookMessage>-Writes a message through the webhook.

Source

seyfert/src/structures/Webhook.ts:120


methods()

1
static methods(__namedParameters: Object): Object

Static methods related to managing webhooks.

Parameters

ParameterType
__namedParametersObject
__namedParameters.clientUsingClient
__namedParameters.webhookIdstring
__namedParameters.webhookToken?string

Returns

Object

MemberTypeValueDescription
delete(reason?: string) => Promise<never>-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.

Source

seyfert/src/structures/Webhook.ts:136