Webhook
Represents a Discord webhook.
Signature
export interface Webhook extends DiscordBase, ObjectToLower<Omit<APIWebhook, 'user' | 'source_guild'>>Properties
16Methods
6Properties
user?: UserStructure;The user associated with the webhook, if applicable.
sourceGuild?: Partial<AnonymousGuildStructure>;The source guild of the webhook, if applicable.
messages: ReturnType<typeof Webhook.messages>;Methods related to interacting with messages through the webhook.
id: string;createdTimestampGetterget createdTimestamp(): number;Create a timestamp for the current object.
createdAtGetterget createdAt(): Date;createdAt gets the creation Date instace of the current object.
readonly client: UsingClient;type: WebhookType;url?: string | undefined;guildId?: string | undefined;avatar: string | null;token?: string | undefined;name: string | null;applicationId: string | null;channelId: string;sourceChannel?: { id: string; type: ChannelType; name?: string | null | undefined; } | undefined;Methods
guild(mode?: 'rest' | 'flow'): Promise<GuildStructure<'cached' | 'api'> | undefined>;guild(mode: 'cache'): ReturnCache<GuildStructure<'cached'> | undefined>;Fetches the guild associated with the webhook.
force- Whether to force fetching the guild even if it's already cached.
A promise that resolves to the guild associated with the webhook, or undefined if not applicable.
channel(mode?: 'rest' | 'flow'): Promise<AllChannels>;channel(mode: 'cache'): ReturnCache<AllChannels | undefined>;Fetches the channel associated with the webhook.
force- Whether to force fetching the channel even if it's already cached.
A promise that resolves to the channel associated with the webhook, or undefined if not applicable.
avatarURL(options?: ImageOptions): string | null;Retrieves the avatar URL of the webhook.
options- The image options for the avatar.
The avatar URL of the webhook, or null if no avatar is set.
fetch(): Promise<WebhookStructure>;Fetches the webhook data from the Discord API.
A promise that resolves to the fetched webhook data.
edit(body: RESTPatchAPIWebhookJSONBody | RESTPatchAPIWebhookWithTokenJSONBody, reason?: string): Promise<WebhookStructure>;Edits the webhook.
body- The new webhook data.
reason- The reason for editing the webhook.
A promise that resolves when the webhook is successfully edited.
delete(reason?: string): Promise<undefined>;Deletes the webhook.
reason- The reason for deleting the webhook.
A promise that resolves when the webhook is successfully deleted.