Skip to content

Commit

Permalink
Added documentation for Fetcher & remade README.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ayfri committed Jan 24, 2021
1 parent e51b9fc commit f72f382
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,28 @@ These operations took a long time to process. Be patient and avoid doing this of
</strong>

```js
const fetchedGuildMessages = await require('discord-fetch-messages').fetchGuildMessages(client, id);
const fetcher = new Fetcher(client);

const fetchedChannelMessages = await require('discord-fetch-messages').fetchChannelMessages(client, id);
fetcher.on('fetchChannel', async channel => {
await message.channel.send(`Fetching <#${channel.id}>.`);
});

await fetcher.fetchGuild(guildID);
await fetcher.fetchChannel(channel);
```

Note :
##

## Event list :

| Event Name | Description | Arguments |
| -------------- | ------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ |
| `fetchChannel` | Emitter when fetching a Channel. | `channel`: The channel fetched. |
| `fetchGuild` | Emitted when fetching a Guild. | `guild`: The guild fetched. |
| `fetch` | Emitted after fetched a bulk a of messages, can fetch 0 to 100 messages. | `length`: The number of messages fetched.<br/>`messages`: The messages fetched, as a Collection. |

You can also use a `fetching` boolean property that is set to true when fetching a bulk of message, then to false.

> Note :
>
> Node.js > 14 is required.

0 comments on commit f72f382

Please sign in to comment.