Skip to content

Commit

Permalink
fix poll question
Browse files Browse the repository at this point in the history
  • Loading branch information
Starman3787 committed Nov 21, 2024
1 parent 3ef2413 commit 22d274c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/structures/Poll.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class Poll {
* @public
*/
get question() {
return this.#question;
return `${this.#question.emoji ? `${Emoji.getMention(this.#question.emoji.name, this.#question.emoji.id, this.#question.emoji.animated)} ` : ""}${this.#question.text ? this.#question.text : ""}`;
}

/**
Expand Down Expand Up @@ -211,7 +211,7 @@ class Poll {
case TO_JSON_TYPES_ENUM.CACHE_FORMAT:
case TO_JSON_TYPES_ENUM.STORAGE_FORMAT: {
return {
question: this.question,
question: this.#question,
answers: this.#answers,
expiry: this.expiry ? this.expiry * 1000 : null,
allow_multiselect: this.allowMultiselect,
Expand All @@ -222,7 +222,7 @@ class Poll {
case TO_JSON_TYPES_ENUM.DISCORD_FORMAT:
default: {
return {
question: this.question,
question: this.#question,
answers: this.#answers,
expiry: this.expiry
? new Date(this.expiry * 1000).toISOString()
Expand Down
4 changes: 3 additions & 1 deletion src/testData.js
Original file line number Diff line number Diff line change
Expand Up @@ -1019,7 +1019,9 @@ export const TEST_DATA = {
image: "000000000000000000000000deadbeef",
},
POLL: {
question: "test poll",
question: {
text: "test poll",
},
answers: [
{
answer_id: 1,
Expand Down
2 changes: 1 addition & 1 deletion test/structures/Poll.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe("Poll", function () {
const poll = new Poll(client, TEST_DATA.POLL, {
guildId: TEST_DATA.GUILD_ID,
});
expect(poll.question).to.equal(TEST_DATA.POLL.question);
expect(poll.question).to.equal(TEST_DATA.POLL.question.text);
});
});

Expand Down

0 comments on commit 22d274c

Please sign in to comment.