Webhook
Represents a Discord webhook.
Extends
DiscordBase
.ObjectToLower
<Omit
<APIWebhook
,"user"
|"source_guild"
>>
Constructors
new Webhook(client, data)
1new Webhook(client: UsingClient, data: APIWebhook): Webhook
Constructs a new Webhook instance.
Parameters
Parameter | Type | Description |
---|---|---|
client | UsingClient | The Discord client instance. |
data | APIWebhook | The data representing the webhook. |
Returns
Inherited from
DiscordBase.constructor
Source
seyfert/src/structures/Webhook.ts:41
Properties
Property | Modifier | Type | Description | Inherited from |
---|---|---|---|---|
applicationId | public | null | string | - | ObjectToLower.applicationId |
avatar | public | null | string | - | ObjectToLower.avatar |
channelId | public | string | - | ObjectToLower.channelId |
client | readonly | UsingClient | - | DiscordBase.client |
guildId | public | undefined | string | - | ObjectToLower.guildId |
id | public | string | - | DiscordBase.id |
messages | public | Object | Methods related to interacting with messages through the webhook. | - |
messages.delete | public | (messageId : string , reason ?: string ) => Promise <never > | Deletes a message sent through the webhook. | - |
messages.edit | public | (payload : Object ) => Promise <WebhookMessage > | Edits a message sent through the webhook. | - |
messages.write | public | (payload : Object ) => Promise <null | WebhookMessage > | Writes a message through the webhook. | - |
name | public | null | string | - | ObjectToLower.name |
sourceChannel | public | undefined | Object | - | ObjectToLower.sourceChannel |
sourceGuild? | public | Partial <AnonymousGuild > | The source guild of the webhook, if applicable. | - |
token | public | undefined | string | - | ObjectToLower.token |
type | public | WebhookType | - | ObjectToLower.type |
url | public | undefined | string | - | ObjectToLower.url |
user? | public | User | The user associated with the webhook, if applicable. | - |
Accessors
createdAt
1get createdAt(): Date
createdAt gets the creation Date instace of the current object.
Returns
Date
Source
seyfert/src/structures/extra/DiscordBase.ts:27
createdTimestamp
1get createdTimestamp(): number
Create a timestamp for the current object.
Returns
number
Source
seyfert/src/structures/extra/DiscordBase.ts:20
Methods
avatarURL()
1avatarURL(options?: CDNUrlOptions): null | string
Retrieves the avatar URL of the webhook.
Parameters
Parameter | Type | Description |
---|---|---|
options ? | CDNUrlOptions | The 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()
1channel(force: boolean): Promise<undefined | BaseChannel<ChannelType> | DMChannel | CategoryChannel>
Fetches the channel associated with the webhook.
Parameters
Parameter | Type | Default value | Description |
---|---|---|---|
force | boolean | false | Whether 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()
1delete(reason?: string): Promise<never>
Deletes the webhook.
Parameters
Parameter | Type | Description |
---|---|---|
reason ? | string | The 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()
1edit(body: RESTPatchAPIWebhookJSONBody | RESTPatchAPIWebhookWithTokenJSONBody, reason?: string): Promise<Webhook>
Edits the webhook.
Parameters
Parameter | Type | Description |
---|---|---|
body | RESTPatchAPIWebhookJSONBody | RESTPatchAPIWebhookWithTokenJSONBody | The new webhook data. |
reason ? | string | The 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()
1fetch(): 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()
1guild(force: boolean): undefined | Promise<Guild<"cached"> | Guild<"api">>
Fetches the guild associated with the webhook.
Parameters
Parameter | Type | Default value | Description |
---|---|---|---|
force | boolean | false | Whether 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()
1static messages(__namedParameters: Object): Object
Static methods related to interacting with messages through webhooks.
Parameters
Parameter | Type |
---|---|
__namedParameters | Object |
__namedParameters.client | UsingClient |
__namedParameters.webhookId | string |
__namedParameters.webhookToken | string |
Returns
Object
Member | Type | Value | Description |
---|---|---|---|
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()
1static methods(__namedParameters: Object): Object
Static methods related to managing webhooks.
Parameters
Parameter | Type |
---|---|
__namedParameters | Object |
__namedParameters.client | UsingClient |
__namedParameters.webhookId | string |
__namedParameters.webhookToken ? | string |
Returns
Object
Member | Type | Value | Description |
---|---|---|---|
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. |