mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
docs(*): add links to Discord's API objects & data (#5862)
This commit is contained in:
@@ -68,13 +68,13 @@ class Webhook {
|
||||
|
||||
/**
|
||||
* The owner of the webhook
|
||||
* @type {?User|Object}
|
||||
* @type {?User|APIUser}
|
||||
*/
|
||||
this.owner = data.user ? this.client.users?.add(data.user) ?? data.user : null;
|
||||
|
||||
/**
|
||||
* The source guild of the webhook
|
||||
* @type {?Guild|Object}
|
||||
* @type {?Guild|APIGuild}
|
||||
*/
|
||||
this.sourceGuild = data.source_guild
|
||||
? this.client.guilds?.add(data.source_guild, false) ?? data.source_guild
|
||||
@@ -82,7 +82,7 @@ class Webhook {
|
||||
|
||||
/**
|
||||
* The source channel of the webhook
|
||||
* @type {?Channel|Object}
|
||||
* @type {?Channel|APIChannel}
|
||||
*/
|
||||
this.sourceChannel = this.client.channels?.resolve(data.source_channel?.id) ?? data.source_channel ?? null;
|
||||
}
|
||||
@@ -97,7 +97,7 @@ class Webhook {
|
||||
/**
|
||||
* Options that can be passed into editMessage.
|
||||
* @typedef {Object} WebhookEditMessageOptions
|
||||
* @property {MessageEmbed[]|Object[]} [embeds] See {@link WebhookMessageOptions#embeds}
|
||||
* @property {MessageEmbed[]|APIEmbed[]} [embeds] See {@link WebhookMessageOptions#embeds}
|
||||
* @property {string} [content] See {@link BaseMessageOptions#content}
|
||||
* @property {FileOptions[]|BufferResolvable[]|MessageAttachment[]} [files] See {@link BaseMessageOptions#files}
|
||||
* @property {MessageMentionOptions} [allowedMentions] See {@link BaseMessageOptions#allowedMentions}
|
||||
@@ -108,7 +108,7 @@ class Webhook {
|
||||
/**
|
||||
* Sends a message with this webhook.
|
||||
* @param {string|APIMessage|WebhookMessageOptions} options The options to provide
|
||||
* @returns {Promise<Message|Object>}
|
||||
* @returns {Promise<Message|APIMessageRaw>}
|
||||
* @example
|
||||
* // Send a basic message
|
||||
* webhook.send('hello!')
|
||||
@@ -195,6 +195,7 @@ class Webhook {
|
||||
* 'ts': Date.now() / 1000
|
||||
* }]
|
||||
* }).catch(console.error);
|
||||
* @see {@link https://api.slack.com/messaging/webhooks}
|
||||
*/
|
||||
sendSlackMessage(body) {
|
||||
if (!this.token) throw new Error('WEBHOOK_TOKEN_UNAVAILABLE');
|
||||
@@ -243,7 +244,7 @@ class Webhook {
|
||||
* Gets a message that was sent by this webhook.
|
||||
* @param {Snowflake|'@original'} message The ID of the message to fetch
|
||||
* @param {boolean} [cache=true] Whether to cache the message
|
||||
* @returns {Promise<Message|Object>} Returns the raw message data if the webhook was instantiated as a
|
||||
* @returns {Promise<Message|APIMessageRaw>} Returns the raw message data if the webhook was instantiated as a
|
||||
* {@link WebhookClient} or if the channel is uncached, otherwise a {@link Message} will be returned
|
||||
*/
|
||||
async fetchMessage(message, cache = true) {
|
||||
@@ -257,7 +258,7 @@ class Webhook {
|
||||
* Edits a message that was sent by this webhook.
|
||||
* @param {MessageResolvable|'@original'} message The message to edit
|
||||
* @param {string|APIMessage|WebhookEditMessageOptions} options The options to provide
|
||||
* @returns {Promise<Message|Object>} Returns the raw message data if the webhook was instantiated as a
|
||||
* @returns {Promise<Message|APIMessageRaw>} Returns the raw message data if the webhook was instantiated as a
|
||||
* {@link WebhookClient} or if the channel is uncached, otherwise a {@link Message} will be returned
|
||||
*/
|
||||
async editMessage(message, options) {
|
||||
|
||||
Reference in New Issue
Block a user