Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polls #2646

Closed
3 tasks done
rakosi2 opened this issue Apr 11, 2024 · 6 comments
Closed
3 tasks done

Polls #2646

rakosi2 opened this issue Apr 11, 2024 · 6 comments
Labels
status: completed has been completed but is not yet released

Comments

@rakosi2
Copy link

rakosi2 commented Apr 11, 2024

General Troubleshooting

  • I have checked for similar issues on the Issue-tracker.
  • I have updated to the latest JDA version
  • I have checked the branches or the maintainers' PRs for upcoming features.

Feature Request

Allow getMessage() to see if the message contains a poll and get its contents.
Currently, there is no way to disable polls and anyone with send message perms are able to send polls.
Discord has now enabled polls on all servers and this is causing users to bypass filters and create spam.
Messages with polls are currently MessageType.DEFAULT and have content of "".

https://support.discord.com/hc/en-us/articles/22163184112407-Polls-FAQ#h_01HSED5BPEDH4YYFVVCXQ2NKZ1

Example Use-Case

getMessage().getPoll()
@Andre601
Copy link
Contributor

Personally speaking, I feel like this would not be a reliable way at all to check for polls.

While I haven't encountered any other cases, I'm sure there can be situations where a message may not contain any content while of message type default (I would assume Webhook messages can be?).
This just wouldn't be reliable in the slightest.

What should be done instead is to request proper addition of API from Discord, so that bots have a reliable way of figuring out if a message is a poll... As an example:

  • A poll attribute in the Message object or alternatively a POLL message type
  • Endpoints to retrieve Poll data from a message
  • Endpoints to POST own polls
  • Websocket Events (or whatever it would be) for Polls (Creation, deletion, answering, ending, etc)

I agree that Polls in their current form are a mess to put it very simple, so changes are necessary here.

In the meantime, set up auto-mod rules, since Polls also are send through it, so if you have a decent auto-mod setup, polls may not get send at all.

@rakosi2
Copy link
Author

rakosi2 commented Apr 11, 2024

If you look at the raw data, it is similar to an embed but unlike an embed, only one poll can be in a message.

@Andre601
Copy link
Contributor

I've looked at the API docs repository of Discord and it seems there is actually API available, just not yet documented.
And from what I can see is it pretty much what I was talking about above, meaning:

  • a poll? attribute in the retrieved message/interaction object that also contains info such as the question, answers, expiry date, etc.
  • Gateway events for poll creation and removal

So, we better should wait for the docs to be finalized and published before making any changes to JDA here.

@freya022
Copy link
Contributor

If your goal is to know if a poll is in a message, you can check it the data Discord sends with MessageReceivedEvent.getRawData(), after enabling JDABuilder#setEventPassthrough

@MinnDevelopment MinnDevelopment added type: discord issue seems to be an issue on discord's end status: in progress already in the process of being implemented labels Apr 13, 2024
@MinnDevelopment MinnDevelopment mentioned this issue Apr 13, 2024
6 tasks
@MinnDevelopment
Copy link
Member

There is a usable PR (#2649), which implements polls. However, the underlying API is still somewhat unstable and not fully released by Discord.

@MinnDevelopment MinnDevelopment added status: completed has been completed but is not yet released and removed status: in progress already in the process of being implemented type: discord issue seems to be an issue on discord's end labels Apr 21, 2024
@MinnDevelopment
Copy link
Member

This is now supported in 5.0.0-beta.23

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: completed has been completed but is not yet released
Projects
None yet
Development

No branches or pull requests

4 participants