Skip to content

Commit

Permalink
Prettified code.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ayfri committed Nov 22, 2020
1 parent 9e4246f commit 37cf1d6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

A npm package to fetch all the messages from a guild or a channel.


## How to use it

<strong>⚠️ READ BEFORE USING ⚠️ <br>
Expand All @@ -22,4 +21,5 @@ const fetchedChannelMessages = await require('discord-fetch-messages').fetchChan
```

Note :

> Node.js > 14 is required.
11 changes: 8 additions & 3 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,15 @@ async function fetchChannelMessages(client, channel) {
async function fetchGuildMessages(client, guildID) {
const m = [];
const channels = client.guilds.cache.get(guildID).channels.cache.filter(c => c.isText());
console.log(`Getting the messages from these channels : ${channels.map(c => `#${c.name}`).sort().join('\n')}`);

console.log(
`Getting the messages from these channels : ${channels
.map(c => `#${c.name}`)
.sort()
.join('\n')}`
);

for (const channel of channels.array()) {
console.log(`Getting messages from : #${channel.name}.`)
console.log(`Getting messages from : #${channel.name}.`);
const messages = await fetchChannelMessages(client, channel);

if (!m.find(c => c.id === channel.id))
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 37cf1d6

Please sign in to comment.