From 48544f2870090c7f280c2d66a4d0e4d1bb04408d Mon Sep 17 00:00:00 2001 From: Kovacs Alex Date: Tue, 18 Aug 2020 18:10:32 +0300 Subject: [PATCH] fix(Paginator): create reaction collector before reacting to message --- src/lib/util/Paginator.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/util/Paginator.ts b/src/lib/util/Paginator.ts index d4db61ac..e963ce63 100644 --- a/src/lib/util/Paginator.ts +++ b/src/lib/util/Paginator.ts @@ -35,9 +35,9 @@ export class Paginator { public async start(): Promise { // 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);