mirror of
https://github.com/danbulant/discord.js
synced 2026-05-27 22:11:53 +00:00
docs: add examples & improve notices
This commit is contained in:
parent
0387d34ab4
commit
c699888780
1 changed files with 14 additions and 0 deletions
|
|
@ -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.
|
||||
* <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
|
||||
* @returns {Promise<Collection<Snowflake, Message>>}
|
||||
* @example
|
||||
|
|
@ -207,6 +209,11 @@ class TextBasedChannel {
|
|||
* channel.fetchMessages({ limit: 10 })
|
||||
* .then(messages => console.log(`Received ${messages.size} messages`))
|
||||
* .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 = {}) {
|
||||
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.
|
||||
* <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>>}
|
||||
* @example
|
||||
* // Get pinned messages
|
||||
* channel.fetchPinnedMessages()
|
||||
* .then(messages => console.log(`Received ${messages.size} messages`))
|
||||
* .catch(console.error);
|
||||
*/
|
||||
fetchPinnedMessages() {
|
||||
return this.client.rest.methods.getChannelPinnedMessages(this).then(data => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue