#How do I create a native Poll?

6 messages · Page 1 of 1 (latest)

pale jungleBOT
#
  • What's your exact discord.js npm list discord.js and node node -v version?
  • Not a discord.js issue? Check out #1081585952654360687.
  • Consider reading #how-to-get-help to improve your question!
  • Explain what exactly your issue is.
  • Post the full error stack trace, not just the top part!
  • Show your code!
  • Issue solved? Press the button!
tender current
#

Full error stack trace:
node:events:496 throw er; // INS Unhandled 'error' event^ DiscordAPIError[50035]:
at handleErrors (/home/user/nominate/node_modules/@discordjs/rest/dist/index.js:730:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async SequentialHandler.runRequest (/home/user/nominate/node_modules/@discordjs/rest/dist/index.js:1133:23)
at async SequentialHandler.queueRequest (/home/user/nominate/node_modules/@discordjs/rest/dist/index.js:963:14)
at async _REST.request (/home/user/nominate/node_modules/@discordjs/rest/dist/index.js:1278:22)
at async ThreadChannel.send (/home/user/nominate/node_modules/discord.js/src/structures/interfaces/TextBasedChannel.js:177:15)
at async /home/user/nominate/bot.js:27:5
at async Client.<anonymous> (/home/user/nominate/bot.js:16:3)
Emitted 'error' event on Client instance at:
at emitUnhandledRejectionOrErr (node:events:401:10)
at process.processTicksAndRejections (node:internal/process/task_queues:84:21) {
requestBody: {
files: [],
json: {
content: '',
tts: false,
nonce: undefined,
enforce_nonce: false,
embeds: undefined,
components: undefined,
username: undefined,
avatar_url: undefined,
allowed_mentions: undefined,
flags: undefined,
message_reference: undefined,
attachments: undefined,
sticker_ids: undefined,
thread_name: undefined,
applied_tags: undefined,
poll: {
question: { text: 'Should FoxMeDead be promoted?' },
answers: [ { poll_media: [Object] }, { poll_media: [Object] } ],
duration: 336,
allow_multiselect: undefined,
layout_type: undefined
}}},
rawError: {message: 'Invalid Form Body',code: 50035,errors: {poll: {answers: {
'0': { poll_media: [Object] },
'1': { poll_media: [Object] }
}}}},code: 50035,status: 400,method:'POST',url:'https://discord.com/api/v10/channels/1253139926908932187/messages'
}

#

the INS is the bit that I mentioned before, I hit the character limit so

next mirage
#

the api itself does require a poll_media, but djs simplifies that, so you only need to directly include the text and the emoji, which is an EmojiResolvable