Skip to content
This repository has been archived by the owner on Jan 6, 2022. It is now read-only.

Commit

Permalink
fix(Paginator): create reaction collector before reacting to message
Browse files Browse the repository at this point in the history
  • Loading branch information
alexthemaster committed Aug 18, 2020
1 parent 25fb2f3 commit 48544f2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib/util/Paginator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ export class Paginator {
public async start(): Promise<void> {
// Send a message with the default page embed
const message = await this._message.channel.send(this.pages[this.currentPage - 1].setFooter(this.footer));
this._collector = message.createReactionCollector((_reaction, user: User) => user === this._message.author);
// React to the sent message with all the navigation emojis
await Promise.all(Object.values(this._navigation).map(async value => await message.react(value)));
this._collector = message.createReactionCollector((_reaction, user: User) => user === this._message.author);
// Use the collector created above to "listen" for new reactions
this._collector.on('collect', async (reaction) => {
const action = getKeyByValue(this._navigation, reaction.emoji.name);
Expand Down

0 comments on commit 48544f2

Please sign in to comment.