Skip to content

Commit

Permalink
refactor: Reformat code.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ayfri committed Mar 21, 2021
1 parent 16f4445 commit ce69e42
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions src/Fetcher.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Client, Message, Collection, Snowflake, TextChannel, Guild } from 'discord.js';
import { EventEmitter } from 'events';
import {Client, Collection, Guild, Message, Snowflake, TextChannel} from 'discord.js';
import {EventEmitter} from 'events';

/**
* The main class used to fetch things.
Expand Down Expand Up @@ -51,7 +51,7 @@ export class Fetcher extends EventEmitter {
}
return messages;
}

/**
* Fetch an array of Snowflakes or TextChannels or a collection of TextChannels.
* @param channels - The channels to fetch.
Expand All @@ -60,14 +60,14 @@ export class Fetcher extends EventEmitter {
public async fetchChannels(channels: Array<Snowflake | TextChannel> | Collection<Snowflake, TextChannel>): Promise<Collection<Snowflake, Message>> {
if (channels instanceof Collection) channels = channels.array();
let messages = new Collection<Snowflake, Message>();

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

return messages;
}

Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export { fetchChannelMessages, fetchGuildMessages } from './main.js';
export { Fetcher } from './Fetcher';
export {fetchChannelMessages, fetchGuildMessages} from './main.js';
export {Fetcher} from './Fetcher';
2 changes: 1 addition & 1 deletion src/main.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { deprecate } = require('util');
const {deprecate} = require('util');

/**
* Fetch all the messages from a Discord TextChannel.
Expand Down

0 comments on commit ce69e42

Please sign in to comment.