Skip to content

Commit

Permalink
Merge pull request #1 from s35400/s35400-patch-1
Browse files Browse the repository at this point in the history
Fix fetchGuildMessages function
  • Loading branch information
siim0n authored Oct 21, 2020
2 parents 3245a6c + b6e8466 commit 68c1164
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,12 @@ async function fetchChannelMessages(client, channel) {
/**
* Fetch all the messages from a Discord Guild.
* @param {module:"discord.js".Client} client - The Discord Client.
* @param {string} - A guild ID
* @returns {Promise<module:"discord.js".Message[]>} - All the messages fetched.
*/
async function fetchGuildMessages(client) {
async function fetchGuildMessages(client, guildID) {
const m = [];
const channels = client.guilds.cache.get('507389389098188820').channels.cache.filter(c => c.isText());
const channels = client.guilds.cache.get(guildID).channels.cache.filter(c => c.isText());
console.log(channels);
for (const channel of channels.array()) {
const messages = await fetchChannelMessages(client, channel);
Expand Down

0 comments on commit 68c1164

Please sign in to comment.