mirror of
https://github.com/discordjs/discord.js.git
synced 2026-06-02 17:10:08 +00:00
docs: improvements
This commit is contained in:
@@ -93,14 +93,46 @@ class Webhook {
|
||||
/**
|
||||
* Send a message with this webhook.
|
||||
* @param {StringResolvable} content The content to send
|
||||
* @param {WebhookMessageOptions|Attachment|RichEmbed} [options] The options to provide
|
||||
* @param {WebhookMessageOptions|Attachment|RichEmbed} [options] The options to provide,
|
||||
* can also be just a RichEmbed or Attachment
|
||||
* @returns {Promise<Message|Message[]|Object|Object[]>}
|
||||
* @example
|
||||
* // Send a message
|
||||
* // Send a basic message
|
||||
* webhook.send('hello!')
|
||||
* .then(message => console.log(`Sent message: ${message.content}`))
|
||||
* .catch(console.error);
|
||||
* @example
|
||||
* // Send a remote file
|
||||
* webhook.send({
|
||||
* files: ['https://cdn.discordapp.com/icons/222078108977594368/6e1019b3179d71046e463a75915e7244.png?size=2048']
|
||||
* })
|
||||
* .then(console.log)
|
||||
* .catch(console.error);
|
||||
* @example
|
||||
* // Send a local file
|
||||
* webhook.send({
|
||||
* files: [{
|
||||
* attachment: 'entire/path/to/file.jpg',
|
||||
* name: 'file.jpg'
|
||||
* }]
|
||||
* })
|
||||
* .then(console.log)
|
||||
* .catch(console.error);
|
||||
* @example
|
||||
* // Send an embed with a local image inside
|
||||
* webhook.send('This is an embed', {
|
||||
* embeds: [{
|
||||
* thumbnail: {
|
||||
* url: 'attachment://file.jpg'
|
||||
* }
|
||||
* }],
|
||||
* files: [{
|
||||
* attachment: 'entire/path/to/file.jpg',
|
||||
* name: 'file.jpg'
|
||||
* }]
|
||||
* })
|
||||
* .then(console.log)
|
||||
* .catch(console.error);
|
||||
*/
|
||||
send(content, options) { // eslint-disable-line complexity
|
||||
if (!options && typeof content === 'object' && !(content instanceof Array)) {
|
||||
|
||||
Reference in New Issue
Block a user