mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-19 04:53:30 +01:00
docs: add examples & improve notices
This commit is contained in:
@@ -200,6 +200,8 @@ class TextBasedChannel {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the past messages sent in this channel. Resolves with a collection mapping message ID's to Message objects.
|
* Gets the past messages sent in this channel. Resolves with a collection mapping message ID's to Message objects.
|
||||||
|
* <info>The returned Collection does not contain reaction users of the messages if they were not cached.
|
||||||
|
* Those need to be fetched separately in such a case.</info>
|
||||||
* @param {ChannelLogsQueryOptions} [options={}] Query parameters to pass in
|
* @param {ChannelLogsQueryOptions} [options={}] Query parameters to pass in
|
||||||
* @returns {Promise<Collection<Snowflake, Message>>}
|
* @returns {Promise<Collection<Snowflake, Message>>}
|
||||||
* @example
|
* @example
|
||||||
@@ -207,6 +209,11 @@ class TextBasedChannel {
|
|||||||
* channel.fetchMessages({ limit: 10 })
|
* channel.fetchMessages({ limit: 10 })
|
||||||
* .then(messages => console.log(`Received ${messages.size} messages`))
|
* .then(messages => console.log(`Received ${messages.size} messages`))
|
||||||
* .catch(console.error);
|
* .catch(console.error);
|
||||||
|
* @example
|
||||||
|
* // Get messages and filter by user ID
|
||||||
|
* channel.fetchMessages()
|
||||||
|
* .then(messages => console.log(`${messages.filter(m => m.author.id === '84484653687267328').size} messages`))
|
||||||
|
* .catch(console.error);
|
||||||
*/
|
*/
|
||||||
fetchMessages(options = {}) {
|
fetchMessages(options = {}) {
|
||||||
return this.client.rest.methods.getChannelMessages(this, options).then(data => {
|
return this.client.rest.methods.getChannelMessages(this, options).then(data => {
|
||||||
@@ -222,7 +229,14 @@ class TextBasedChannel {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetches the pinned messages of this channel and returns a collection of them.
|
* Fetches the pinned messages of this channel and returns a collection of them.
|
||||||
|
* <info>The returned Collection does not contain any reaction data of the messages.
|
||||||
|
* Those need to be fetched separately.</info>
|
||||||
* @returns {Promise<Collection<Snowflake, Message>>}
|
* @returns {Promise<Collection<Snowflake, Message>>}
|
||||||
|
* @example
|
||||||
|
* // Get pinned messages
|
||||||
|
* channel.fetchPinnedMessages()
|
||||||
|
* .then(messages => console.log(`Received ${messages.size} messages`))
|
||||||
|
* .catch(console.error);
|
||||||
*/
|
*/
|
||||||
fetchPinnedMessages() {
|
fetchPinnedMessages() {
|
||||||
return this.client.rest.methods.getChannelPinnedMessages(this).then(data => {
|
return this.client.rest.methods.getChannelPinnedMessages(this).then(data => {
|
||||||
|
|||||||
Reference in New Issue
Block a user