From b6e84660feff6f78631261370f2101ca95a8e32f Mon Sep 17 00:00:00 2001 From: Carambaaar <44496148+s35400@users.noreply.github.com> Date: Wed, 21 Oct 2020 16:31:00 +0200 Subject: [PATCH] Fix fetchGuildMessages function --- main.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/main.js b/main.js index a2c06d8..7f3e295 100644 --- a/main.js +++ b/main.js @@ -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} - 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);