diff --git a/packages/discord.js/src/structures/Poll.js b/packages/discord.js/src/structures/Poll.js index 3fd0630e4..202c94ade 100644 --- a/packages/discord.js/src/structures/Poll.js +++ b/packages/discord.js/src/structures/Poll.js @@ -43,10 +43,27 @@ class Poll extends Base { Object.defineProperty(this, 'message', { value: message }); + /** + * The answers of this poll + * @type {Collection} + */ + this.answers = new Collection(); + this._patch(data); } _patch(data) { + if (data.answers) { + for (const answer of data.answers) { + const existing = this.answers.get(answer.answer_id); + if (existing) { + existing._patch(answer); + } else { + this.answers.set(answer.answer_id, new PollAnswer(this.client, answer, this)); + } + } + } + if (data.results) { /** * Whether this poll's results have been precisely counted @@ -111,23 +128,6 @@ class Poll extends Base { text: null, }; } - - /** - * The answers of this poll - * @type {Collection} - */ - this.answers ??= new Collection(); - - if (data.answers) { - for (const answer of data.answers) { - const existing = this.answers.get(answer.answer_id); - if (existing) { - existing._patch(answer); - } else { - this.answers.set(answer.answer_id, new PollAnswer(this.client, answer, this)); - } - } - } } /**