Skip to content

Commit

Permalink
refactor: Use fetchChannels in fetchGuild.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ayfri committed Mar 21, 2021
1 parent 8271515 commit a2dd77c
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions src/Fetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,9 @@ export class Fetcher extends EventEmitter {
const guild = guildID instanceof Guild ? guildID : await this.client.guilds.fetch(guildID);
let messages = new Collection<Snowflake, Message>();
if (guild) {
this.fetching = true;
const channels = guild.channels.cache.filter(c => c.isText()) as Collection<Snowflake, TextChannel>;
this.emit('fetchGuild', guild);

for (const channel of channels.array()) {
const channelMessages = await this.fetchChannel(channel);
messages = messages.concat(channelMessages);
}

this.fetching = false;
messages = await this.fetchChannels(channels);
}

return messages;
Expand Down

0 comments on commit a2dd77c

Please sign in to comment.