From 17f245485d849e940bb11769c4176964d2015a74 Mon Sep 17 00:00:00 2001 From: purpshell Date: Fri, 23 Dec 2022 15:09:44 +0200 Subject: [PATCH] bugfix --- src/Client.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/Client.js b/src/Client.js index 75235cb..e3407e3 100644 --- a/src/Client.js +++ b/src/Client.js @@ -85,7 +85,14 @@ class Client extends EventEmitter { * Sets up events and requirements, kicks off authentication request */ async initialize() { - let [browser, page] = [null, null]; + /** + * @type {puppeteer.Browser} + */ + let browser = null; + /** + * @type {puppeteer.Page} + */ + let page = null; await this.authStrategy.beforeBrowserInitialized(); @@ -489,9 +496,7 @@ class Client extends EventEmitter { }); await page.exposeFunction('onPollVote', (vote) => { - if (vote.parentMsgKey) vote.pollCreationMessage = window.Store.Msg.get(vote.parentMsgKey).serialize(); const vote_ = new PollVote(this, vote); - /** * Emitted when a poll vote is received * @event Client#poll_vote @@ -543,7 +548,12 @@ class Client extends EventEmitter { } } }); - window.Store.PollVote.on('add', (vote) => window.onPollVote(vote)); + + window.Store.PollVote.on('add', (vote) => { + if (vote.parentMsgKey) vote.pollCreationMessage = window.Store.Msg.get(vote.parentMsgKey).serialize(); + window.onPollVote(vote); + }); + { const module = window.Store.createOrUpdateReactionsModule; const ogMethod = module.createOrUpdateReactions;