Suggestion System with Polling

Hello, I want to ask for help to improve my code, I want to create a feature like in the video bellow, so when the embed is first sent it will have 2 buttons, namely upvoteButton.setLabel('⬆️'); and downvoteButton.setLabel('⬇️');. Users can only select one button
if the user selects the "⬆️" { button
then update the button `upvote.setLabel(`⬆️ ${number of votes}`) downvote.setLabel(`⬇️`)` then followUp with the message(`\`\` Upvote added!`). Check if the user selects this "⬆️" button again? If yes then follow up with the message (`\`\` Upvote removed!`).

Check again if there is only 1 user providing interaction. For example, he selects the button "⬆️" then the button will look like this "⬆️ 1" "⬇️". If the user selects the upvote button again then follow up with the message (`\`\` Upvote removed!`) and the button returns to `upvoteButton.setLabel('⬆️');` and `downvoteButton.setLabel('⬇️') ;`
}

if the user selects the "⬇️" { button
then update the button `upvote.setLabel(`⬆️`) downvote.setLabel(`⬇️ ${number of votes}`)` then followUp with the message(`\`\` Downvote added!`). Check if the user selects this "⬇️" button again? If yes then follow up with the message (`\`\` Downvote removed!`).

Check again if there is only 1 user providing interaction. For example, he selects the button "⬆️" then the button will look like this "⬆️ 1" "⬇️". If the user selects the upvote button again then follow up with the message (`\`\` Upvote removed!`) and the button returns to `upvoteButton.setLabel('⬆️');` and `downvoteButton.setLabel('⬇️') ;`
}
if the user selects the "⬆️" { button
then update the button `upvote.setLabel(`⬆️ ${number of votes}`) downvote.setLabel(`⬇️`)` then followUp with the message(`\`\` Upvote added!`). Check if the user selects this "⬆️" button again? If yes then follow up with the message (`\`\` Upvote removed!`).

Check again if there is only 1 user providing interaction. For example, he selects the button "⬆️" then the button will look like this "⬆️ 1" "⬇️". If the user selects the upvote button again then follow up with the message (`\`\` Upvote removed!`) and the button returns to `upvoteButton.setLabel('⬆️');` and `downvoteButton.setLabel('⬇️') ;`
}

if the user selects the "⬇️" { button
then update the button `upvote.setLabel(`⬆️`) downvote.setLabel(`⬇️ ${number of votes}`)` then followUp with the message(`\`\` Downvote added!`). Check if the user selects this "⬇️" button again? If yes then follow up with the message (`\`\` Downvote removed!`).

Check again if there is only 1 user providing interaction. For example, he selects the button "⬆️" then the button will look like this "⬆️ 1" "⬇️". If the user selects the upvote button again then follow up with the message (`\`\` Upvote removed!`) and the button returns to `upvoteButton.setLabel('⬆️');` and `downvoteButton.setLabel('⬇️') ;`
}
- My Code - src\commands\Other\suggest.js: https://sourceb.in/2ouGW3Vt8q - src\index.js: https://sourceb.in/fd8CWW0il7 Watch the video bellow for an example
SourceBin
Suggestion System with Polling
src\commands\Other\suggest.js
SourceBin
Suggestion System with Polling
src\index.js
1 Reply
d.js toolkit
d.js toolkit11mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - 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! - Marked as resolved by OP
Want results from more Discord servers?
Add your server