This commit is contained in:
purpshell
2022-12-23 15:09:44 +02:00
parent 93c8ff7165
commit 17f245485d

View File

@@ -85,7 +85,14 @@ class Client extends EventEmitter {
* Sets up events and requirements, kicks off authentication request * Sets up events and requirements, kicks off authentication request
*/ */
async initialize() { async initialize() {
let [browser, page] = [null, null]; /**
* @type {puppeteer.Browser}
*/
let browser = null;
/**
* @type {puppeteer.Page}
*/
let page = null;
await this.authStrategy.beforeBrowserInitialized(); await this.authStrategy.beforeBrowserInitialized();
@@ -489,9 +496,7 @@ class Client extends EventEmitter {
}); });
await page.exposeFunction('onPollVote', (vote) => { await page.exposeFunction('onPollVote', (vote) => {
if (vote.parentMsgKey) vote.pollCreationMessage = window.Store.Msg.get(vote.parentMsgKey).serialize();
const vote_ = new PollVote(this, vote); const vote_ = new PollVote(this, vote);
/** /**
* Emitted when a poll vote is received * Emitted when a poll vote is received
* @event Client#poll_vote * @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 module = window.Store.createOrUpdateReactionsModule;
const ogMethod = module.createOrUpdateReactions; const ogMethod = module.createOrUpdateReactions;