Skip to content

Commit

Permalink
Improve poll handle
Browse files Browse the repository at this point in the history
  • Loading branch information
hugoalh committed Sep 8, 2024
1 parent 8ef2b4b commit 02a17a8
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions _payload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -553,17 +553,7 @@ export function resolvePoll({
throw new SyntaxError(`Unknown input \`poll.answers[${answerIndex}].${pollAnswerKey}\`!`);
}
}
if (typeof answer.text === "undefined") {
throw new TypeError(`Input \`poll.answers[${answerIndex}]\` is not a valid Discord poll answer!`);
}
const answerFmt: JSONObject = {};
if (typeof answer.emoji !== "undefined") {
answerFmt.emoji = answer.emoji;
}
if (typeof answer.text !== "undefined") {
answerFmt.text = answer.text;
}
return { poll_media: answerFmt };
return { poll_media: answer };
});
if (question.length === 0) {
throw new TypeError(`Input \`poll.question.text\` is not a string (non-empty)!`);
Expand Down

0 comments on commit 02a17a8

Please sign in to comment.