You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I believe this to be a bug because if I omit the content property and just attempt to create a poll, it throws a discord api error stating content is required. So it feels as though it acknowledges the poll property but is doing nothing with it.
Code sample
const{ SlashCommandBuilder, EmbedBuilder }=require('discord.js');const{ emojiCharacters }=require('../../resources/constants');module.exports={data: newSlashCommandBuilder().setName('poll').setDescription('starts a poll on the given topic').addStringOption(option=>option.setName('question').setDescription('the topic in the form of a question').setRequired(true)).addStringOption(option=>option.setName('choices').setDescription('the possible choices, max 10, for the poll in the form of comma separated values')).addRoleOption(option=>option.setName('audience').setDescription('the people intended to respond to the poll')).addBooleanOption(option=>option.setName('multiple').setDescription('true to allow multiple answers. Default is no.')).addNumberOption(option=>option.setName('duration').setDescription('how long, in hours, the poll should remain active.')),asyncexecute(interaction){awaitinteraction.deferReply();constmessage={poll: {question: {text: interaction.options.getString('question')},duration: interaction.options.getNumber('duration')??1,// duration in hours, minimum 1allowMultiselect: interaction.options.getBoolean('multiple')??false},}constchoices=interaction.options.getString('choices');if(choices){constanswers=choices.split(',');message.poll.answers=[];for(leti=0;i<answers.length;i++){message.poll.answers.push({text: answers[i].trim(),emoji: emojiCharacters[i+1]});}}else{message.poll.answers=[{text: 'Yes',emoji: `👍`},{text: 'No',emoji: `👎`}];}console.log(message);awaitinteraction.followUp({content: `Poll started by ${interaction.user.id}`,poll: message.poll})}}
The slash command you provided is indeed editing a message. Think about what you are doing:
You used interaction.deferReply();. This created a message in a channel.
You edit that message via interaction.followUp().
If so it should mentioned somewhere in the docs this is the case.
Perhaps you should read the guide. Specifically, this page:
Note that if you use followUp() after a deferReply(), the first follow-up will edit the <application> is thinking message rather than sending a new one.
Which package is this bug report for?
discord.js
Issue description
I believe this to be a bug because if I omit the
content
property and just attempt to create a poll, it throws a discord api error stating content is required. So it feels as though it acknowledges thepoll
property but is doing nothing with it.Code sample
Versions
Issue priority
Low (slightly annoying)
Which partials do you have configured?
No Partials
Which gateway intents are you subscribing to?
Guilds, GuildMembers, GuildVoiceStates, GuildMessages, MessageContent, GuildMessagePolls
I have tested this issue on a development release
No response
The text was updated successfully, but these errors were encountered: