mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-18 12:33:30 +01:00
docs: TextChannel Webhooks fix&improvement
This commit is contained in:
@@ -55,6 +55,11 @@ class TextChannel extends GuildChannel {
|
|||||||
/**
|
/**
|
||||||
* Fetches all webhooks for the channel.
|
* Fetches all webhooks for the channel.
|
||||||
* @returns {Promise<Collection<Snowflake, Webhook>>}
|
* @returns {Promise<Collection<Snowflake, Webhook>>}
|
||||||
|
* @example
|
||||||
|
* // Fetch webhooks
|
||||||
|
* channel.fetchWebhooks()
|
||||||
|
* .then(hooks => console.log(`This channel has ${hooks.size} hooks`))
|
||||||
|
* .catch(console.error);
|
||||||
*/
|
*/
|
||||||
fetchWebhooks() {
|
fetchWebhooks() {
|
||||||
return this.client.api.channels[this.id].webhooks.get().then(data => {
|
return this.client.api.channels[this.id].webhooks.get().then(data => {
|
||||||
@@ -72,8 +77,12 @@ class TextChannel extends GuildChannel {
|
|||||||
* @param {string} [options.reason] Reason for creating the webhook
|
* @param {string} [options.reason] Reason for creating the webhook
|
||||||
* @returns {Promise<Webhook>} webhook The created webhook
|
* @returns {Promise<Webhook>} webhook The created webhook
|
||||||
* @example
|
* @example
|
||||||
* channel.createWebhook('Snek', 'https://i.imgur.com/mI8XcpG.jpg')
|
* // Create a webhook for the current channel
|
||||||
* .then(webhook => console.log(`Created webhook ${webhook}`))
|
* channel.createWebhook('Snek', {
|
||||||
|
* avatar: 'https://i.imgur.com/mI8XcpG.jpg',
|
||||||
|
* reason: 'Needed a cool new Webhook'
|
||||||
|
* })
|
||||||
|
* .then(console.log)
|
||||||
* .catch(console.error)
|
* .catch(console.error)
|
||||||
*/
|
*/
|
||||||
async createWebhook(name, { avatar, reason } = {}) {
|
async createWebhook(name, { avatar, reason } = {}) {
|
||||||
|
|||||||
Reference in New Issue
Block a user